I'm working with someone who's been doing simulations on various computers and FTPing the results to a website using a script and the basic mac ftp command basically something like (this is not exact just what i remember from when i last looked at it)
ftp -i username@host password
cd /dir/
put file 1
put file 2
...
and so on…
I need to upgrade this process to use SFTP for security purposes, but there's no way that I can tell to put the password in a single line script for the SFTP program that's built into mac OS X. Is there some other way to do this? I tried using something called LFTP which seemed to connect to the server but the files would always stay at 0% when they were trying to transfer. Any help would be appreciated.
Best Answer
No. Generate the key on client (
ssh-keygen
) and upload the public key to server. For example usingssh-copy-id
, if thessh
is allowed on the server. There are many how-to's around the internet, so I believe you will be able to figure out.Then connecting would work like
sftp username@host
(without password). If you have some batch, you can provide it tosftp
using-b
option. For more info, consult manual pages forsftp
or the other above mentioned tools.