Solved

doubt in FTP comment

Posted on 2008-10-13
12
700 Views
Last Modified: 2008-10-19
what is the equilent of
ftp -s:"D:\futureElectronics\temp\ftpcmd.txt" ftp.xxxxx.com
in unix

i am getting error of
ftp: s: unknown option
Usage: ftp [-v] [-d] [-i] [-n] [-g] [-k realm] [-f] [-x] [-u] [-t] [host]
above comment is working fine in windows.i want to run in linux
0
Comment
Question by:priyapratheep
  • 6
  • 3
  • 3
12 Comments
 
LVL 48

Expert Comment

by:Tintin
ID: 22708721
Put the contents of ftpcmd.txt in  $HOME/.netrc and then use ftp like

ftp example.com

0
 

Author Comment

by:priyapratheep
ID: 22708854
i have to create .netrc in home directory?

can u explain little bit?
0
 
LVL 48

Assisted Solution

by:Tintin
Tintin earned 300 total points
ID: 22708916
Whoops, I just remembered that .netrc is just for specifying the login details.

You can either script it, eg:

#!/bin/sh
ftp -in example.com <<EOF
user username pass
cd somedir
get file
quit
EOF

or if you want to keep the commands in a file, do

ftp -in example.com <`cat /path/to/ftpcmd.txt`



0
 
LVL 40

Accepted Solution

by:
omarfarid earned 200 total points
ID: 22708962

You should have a script call it myscript that will ftp file to remote server:

ftp remoteserver <<END
cd /dir
binary
put file
bye
END

If you want to send multiple files then replace put file with the following :

prompt
mput file*.*


- make this script executable:

chmod +x myscript

- For ftp to work without providing any username / password,  use .netrc file in the user's home directory (the one who will run the script). This file should not be readable by others i.e. use
chmod 400 .netrc

The entry in .netrc should be as below:

machine remoteserver
login remoteusername
password mypassword

remoteserver is the server which is the ftp server where you want to sent the file(s)
remoteusername is the remote user login name on the ftp server
mypassword is the password of the remote user on the ftp server

for more info about .netrc, please use man netrc
0
 

Author Comment

by:priyapratheep
ID: 22709076
I give userid and pwd details in ftpcmd.txt file

xxxx
yyyy
cd outbound_to_xxxsys
get future.csv
bye

this is my ftpcmd.txt file where i am giving all the details


my shell program is
#ftp -s:"/var/tomcat/webapps/ROOT/WEB-INF/classes/ftpcmd.txt" ftp.futureelectronics.com
ftp -in ftp.futureelectronics.com <'/var/tomcat/webapps/ROOT/WEB-INF/classes/ftpcmd.txt'


now i am getting error of

[root@newsor classes]# ./future_ele.sh
'AUTH GSSAPI': command not understood
'AUTH KERBEROS_V4': command not understood
KERBEROS_V4 rejected as an authentication type
?Invalid command
?Invalid command
Please login with USER and PASS.
Please login with USER and PASS.
Passive mode refused.  Turning off passive mode.
Please login with USER and PASS.


with this parameters (id and pwd etc) it is working fine in windows env...
0
 
LVL 48

Assisted Solution

by:Tintin
Tintin earned 300 total points
ID: 22709135
xxxx
yyyy

need to be

user xxxx
pass yyyy
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:priyapratheep
ID: 22709147
thanks
some errors gone

now i am getting error of

[root@newsor classes]# ./future_ele.sh
'AUTH GSSAPI': command not understood
'AUTH KERBEROS_V4': command not understood
KERBEROS_V4 rejected as an authentication type
pls advice
0
 

Author Comment

by:priyapratheep
ID: 22709378
any suggestions?
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 22709456
did you try my solution?
0
 

Author Comment

by:priyapratheep
ID: 22709484
now i am trying this

 HOST=ftp.ttttt.com
 FTPUSER=xxxx
 FTPPASSWORD=yyyy
 ftp -n $HOST <<-EOF
 user $FTPUSER $FTPPASSWORD
 cd outbound_to_serialsys
 bin
 get future.csv
 bye
 EOF


program is working fine...but still i am getting error of
[root@newsor classes]# ./futureHan.sh
'AUTH GSSAPI': command not understood
'AUTH KERBEROS_V4': command not understood
KERBEROS_V4 rejected as an authentication type

why it is so?

what is the difference between ftp -n  and ftp -in?

 ftp -n $HOST <<-EOF in this what is the use of -EOF?


thanks
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 22709494
it is not secure to put the username and password in a clear text file like the script you are running.

The .netrc file is meant for protecting you from such thing. It's permissions should be 400 (which is read only for owner and nothing for others)
0
 

Author Comment

by:priyapratheep
ID: 22717444
Eventhough program is working fine I am getting error message of

AUTH GSSAPI': command not understood
'AUTH KERBEROS_V4': command not understood
KERBEROS_V4 rejected as an authentication type

Pls advice



0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Stopping flocksnippet: Killed (core dumped) on doing kill -9 5 70
Identify Linux loader 67 169
Understanding curl command 1 50
Understanding Futures with busy waiting 2 82
Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now