Solved

doubt in FTP comment

Posted on 2008-10-13
12
707 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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 fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

762 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