I want to use a shell-script to transfer data over sftp.
I don�t find a way to login in automatically.
I tried to send the password in a script like possible with
ftp
sftp user@server << cmd
password
cd /distant/directory
lcd /local/directoryget ssh_install
get ( or put) your files
quit
cmd
It doesn�t work. So I tried to use a public key (Public key authentication). But now I always have to write the
passphrase - same problem again.
How is it possible to connect withput password or phrase?
man ssh-keygen or man ssh-keygen2 - depending upon what version of Secure Shell you are using. The ssh-keygen command generates public and private keys for a user. There is a switch on this command (usually -P) which allows for a null passphrase.
Alternatively run ssh-keygen as that user and when you are prompted to enter a passphrase simply enter a carriage return. The keys will be stored with a null passphrase.
If you exchanged the public key correctly you should now be able to copy files without being prompted for a passphrase.