Get ftp without password


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Get ftp without password
# 1  
Old 10-20-2014
Get ftp without password

Dear Masters,

I usually run bash to get file from ftp using command below (user : nobody, password : guest)

Code:
#!/bin/bash
cd /xx/xy/prog

FILE="list_country.xls"

/usr/bin/ftp -in 1.2.116.12 << END
user nobody guest
ascii
cd /XYZ/ABC
binary
get $FILE
quit
END

But in this case, there is no password (ftp itself only need user to access). I need to run bash so I did this

Code:
#!/bin/bash
cd /xx/xy/prog

FILE="list_country.xls"

/usr/bin/ftp -in 1.2.116.12 << END
user nobody
ascii
cd /XYZ/ABC
binary
get $FILE
quit
END

When I run .sh, it keeps asking password and I have to press enter to execute..I need it automatically run

Please help..
# 2  
Old 10-20-2014
You don't say which version of Unix/Linux it is but most support the use of a .netrc file in the home directory of the user running the script to provide automatic ftp connections.

.netrc contains the 'machine' name, and userid/password to use for that system.

NOTE that this file MUST have particular security: ownership, group and mask for it to work.

This is probably the easiest way for you to get automatic ftp use without password (or even userid).

Also, use

Code:
ftp <nodename>

rather than the ip address. The nodename is resolved in /etc/hosts and the .netrc file (in your home directory) will provide remote nodes ftp credentials.

Search this forum for .netrc

Hope that helps.

---------- Post updated at 09:31 AM ---------- Previous update was at 09:22 AM ----------

Also, remember that you can test the functionality interactively by typing
Code:
ftp <nodename>

from your command line before running within your script. If you have configured .netrc properly, the ftp session will connect instantly.

---------- Post updated at 10:34 AM ---------- Previous update was at 09:31 AM ----------

Do be aware that the use of ftp and .netrc is NOT secure in that it transmits unencrypted credentials over the network. Use on a LAN behind a firewall.
# 3  
Old 10-20-2014
also need a password Mr. Hicks?

in my case, when I use filezilla to extract the file, it needs only user, password is blank
# 4  
Old 10-20-2014
What are you saying? You can't get it to work?

What version of Unix?
# 5  
Old 10-20-2014
I'm not familiar with .netrc

I usually use
Code:
FILE="list_country.xls"

/usr/bin/ftp -in 1.2.116.12 << END
user nobody
ascii
cd /XYZ/ABC
binary
get $FILE
quit
END

# 6  
Old 10-20-2014
Okay, you don't want to use .netrc.

So try this:


Code:
 
FILE="list_country.xls"
PASSWD=""

/usr/bin/ftp -in 1.2.116.12 << END
user nobody $PASSWD
ascii
cd /XYZ/ABC
binary
get $FILE
quit
END

or this: (if the ftp server supports anonymous connection)

Code:
 
FILE="list_country.xls"

/usr/bin/ftp -in 1.2.116.12 << END
user anonymous
ascii
cd /XYZ/ABC
binary
get $FILE
quit
END

# 7  
Old 10-20-2014
it keeps asking password..
actually when I access ftp via filezilla, I only need username : nobody
no password
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to setup a password less ftp??

hi, i want to setup a password less FTP to a remote server so that i can ftp to a remote server without the password. i have setup a passwordless ssh and i am able to use scp commands to connect to the remote server without asking for the password. but when i try to ftp to the same remote... (6 Replies)
Discussion started by: Little
6 Replies

2. Shell Programming and Scripting

How: FTP in shell Script without asking password.

Hi In my shell script I am generating one text file and this text file I want to place in Mount point. THis mount point is havig access to Windows. I want to put the file in this mount point by using FTP rather normal cp or mv command from my shell script. This is in order to prevent... (5 Replies)
Discussion started by: shekharjchandra
5 Replies

3. Shell Programming and Scripting

ftp:Password field is displayed

I am trying to get a file by doing ftp to the server. The below script works fine but as I type password it is displayed as simple text. HOST='192.108.245.101' echo 'username: ' read USER echo 'password:' read PASSWD ftp -n $HOST <<END_SCRIPT quote USER $USER quote PASS $PASSWD lcd... (1 Reply)
Discussion started by: hiten.r.chauhan
1 Replies

4. UNIX for Advanced & Expert Users

remote ftp login without password

HI all, I need to post some files on to a clients machine and they said we can ftp without username and password. I do the same as a command line it works ftp <hostname>. but when I do that through a script it asks for user name and pasword. Can any one help me how to do a file ftp. ... (4 Replies)
Discussion started by: umathurumella
4 Replies

5. Shell Programming and Scripting

in ftp how to avoid username/password

hi all i am very new to unix. we had the below scenior test.bat file which contains ftp -s:logfiles.scr servername logfiles.scr contains username password cd path get file bye We had n number of batch(.bat files). which is having the same kind of scr file pointing... (10 Replies)
Discussion started by: nh1
10 Replies

6. UNIX for Dummies Questions & Answers

FTP Download username and password

I am trying to download from ftp server (rsync and postfix). But every time I connect to the ftp server, it prompts for USER and PASS but I don't know which username and and password to use. And I am using command based UNIX OS. (2 Replies)
Discussion started by: kumarrana
2 Replies

7. Shell Programming and Scripting

ftp and user/password

I know the typical way to script automate an ftp session is to pass all of the commands to ftp, with something 'like' the following: echo USER $user echo PASS $pass My question concerns other methods or tricks people have used so that the username and ESPECIALLY the password are... (7 Replies)
Discussion started by: joeyg
7 Replies

8. UNIX for Dummies Questions & Answers

Can an FTP user change their own password?

If we set up FTP only users who can't log in with a shell (/bin/false type of shell) and set them up with a default password, like abc123 or something not secure, is there any way for the user to change their own password once they get on the system? (2 Replies)
Discussion started by: LordJezo
2 Replies

9. Shell Programming and Scripting

Restricted charecters in FTP password

hi i am unable to connect to FTP server.My FTP password contain one special charecter '#'.it might be the problem for connecting.please clarify regarding this special charecter in the password.i need some information about restricted charecters in the shell script. thanks (5 Replies)
Discussion started by: srivsn
5 Replies

10. UNIX for Dummies Questions & Answers

ftp password issue

I think I may have put this in the wrong forum earlier the script that follows is an extract from a post someone gave as an answer to a question on ftp within a script /usr/bin/ftp ftpsiteaddress <<END verbose on bin user username password cd <directoryname> put <filename> mput... (3 Replies)
Discussion started by: Henrik
3 Replies
Login or Register to Ask a Question