Solved

doubt in FTP comment

Posted on 2008-10-13
12
699 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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

758 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

20 Experts available now in Live!

Get 1:1 Help Now