Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi,
I am using sftp to connect to a remote machince (from my unix machine) and placing some files over there.I need to automate this process with a shell script.I am using KShell.
Currently I am connecting as sftp xxx01@sftp.yyy.com.Then it asks for password where I enter 123 and use "put" to place over there.
In one of the posts, I had seen to use a shell script as follows:
cd /a
ftp -n > ftp.log <<!
open ftp.xyz.com
user 123456 password
put filename
Since I do not have a username to enter, how can I modify the script? Also will this ftp command work for me?Please advise.
Thanks,

Wollie Thanks for response. Will the same scipt work for sftp? Apart from using keygen, can I hardcode userid & passwd?
Thanks,
P

Wollie Thanks for response. Will the same scipt work for sftp? Apart from using keygen, can I hardcode userid & passwd?
Thanks,
P

there is no syntactical difference between ftp and sftp.
You can hardcode uid and pw, either with a .netrc - file or in a script. A script version would work like:
sftp user@server ......
or:
sftp
open server
user uid password ....
################
but hardcoding uid and password is a security issue (so why SECURE ftp?). If possible generate an rsa key and you don't have to provide uid and password.cheers
wollie

![]() |
![]() |
![]() |
| Login or Register to Reply | |
| Login | Register |
| Ads by Google |