Solved

doubt in FTP comment

Posted on 2008-10-13
12
712 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
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

Application Discovery Service in AWS

In the era of the cloud, customers migrating away from their existing on-premise infrastructure. This requires lots of planning, strategies, and effort to identify their existing resources and determine how best to migrate.  Datacenter migrations happen in four phases -

Question has a verified solution.

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

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…
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…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

617 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