sshpass – ftp files to a remote drive authenticated with password

Wanna upload files to a linux box? Yeah – get a ssh trust established and sftp your files. Simple, huh..

Now – wanna sftp files to an external drive authenticated by a password? Can’t establish trust relationship. Easy – sftp, provide password, upload files, huh..

Cool – what if you wanna automate the process and avoid the password entry. Here you go. Use ssshpass. This allows you to store password in a file and use this file for authentication. Pretty useful for automating some stuff out there.. La La La La La

Installing sshpass

apt-get install sshpass

Using sshpass to upload files

sshpass -f ~/path_to_password/pass.txt sftp user@remote.location.net:/pools/path/ << EOF
put backup.tar
EOF
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s