Operating System - HP-UX
1833016 Members
2683 Online
110048 Solutions
New Discussion

Re: FTP without prompting userID and password

 
SOLVED
Go to solution
Dewa Negara_4
Regular Advisor

FTP without prompting userID and password

Hi All,

How can we run ftp without prompting userID and password? let say userA run a job that trigger a script on a prticular server. Part of that script will require userA to actually do FTP from that particular server to another one. So userA will run the script as userA and try to ftp over to another server. But now the problem is the ftp will prompt for userID and password. How can we do without prompting userID and password.

Pls help. High score will be given.

Thanks and Best Regards,
Negara


Santos
8 REPLIES 8
Michael Tully
Honored Contributor
Solution

Re: FTP without prompting userID and password

netrc should be the answer.
Have a look at the man pages:

man 4 netrc
Anyone for a Mutiny ?
Dino_4
Frequent Advisor

Re: FTP without prompting userID and password


Hi,

check `man netrc`.

This might help you.
Steve Steel
Honored Contributor

Re: FTP without prompting userID and password

Hi


Would be self defeating if it worked and I doubt if it is possible


use tftp or rcp

see man pages


Steve Steel

If you want truly to understand something, try to change it. (Kurt Lewin)
Senthil Kumar .A_1
Honored Contributor

Re: FTP without prompting userID and password

hello,

u can use "rcp". If password sould not be prompted ,include userA in ~/.rhosts or /etc/hosts.equiv.

for further details consult man pages of rcp.
Let your effort be such, the very words to define it, by a layman - would sound like a "POETRY" ;)
Dewa Negara_4
Regular Advisor

Re: FTP without prompting userID and password

Hi All,

Thanks for all the answer. But I found sone restrictions :
1. I checked man netrc, it seems like we have to put unencrypted password on ~/.netrc. It is not really secure.

2. rcp is disabled on my environment

3. tftp. How can we do that?

Any other methods?

Thanks alot ALL.


Santos
Muthukumar_5
Honored Contributor

Re: FTP without prompting userID and password

We can do it in too method in a shell script as,

1>
anonymous login using netrc files in their $HOME directory as,

machine login password

Change the file permission to 600

2> using a script line as,

ftp -n -i <<-EOF 2>/dev/null
open
ls
status
... ftp operations ...
bye
EOF

A sample program is available in

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=641509






Easy to suggest when don't know about the problem!
Fred Ruffet
Honored Contributor

Re: FTP without prompting userID and password

You say clear text password in .netrc are unsecure. I agree, but I think .rhosts file may also be unsecure.

If you put your .netrc file in 600 mode, it's as secure as having a .rhost file.

If you really want to secure, you can have an encrypted file whith machine, login, password and set your own script to decrypt this file and issue an
ftp -n hostname << EOF
user username password
...
EOF

Regards,

Fred
--

"Reality is just a point of view." (P. K. D.)
Petr Simik_1
Valued Contributor

Re: FTP without prompting userID and password

For tranfering files from serverA to serverB by including user/password inside the script.
Than it will not prompt you to set user/pass.
Inside the script you can manage transfers as you want.

This is the syntax

#/usr/bin/ftp -i -n -v < download.ftp

content of #download.ftp
open hostname
user root passwordz
cd /rdir/
lcd /ldir/
put file1.txt
get file2.txt
bye