SSH password as a command-line parameter?

Matthew Kuiken matt.kuiken at verizon.net
Sun Jun 18 15:31:08 UTC 2006


Daniel Carrera wrote:
> Hello,
>
> I'm working on a remote backup solution for a small website. I want to 
> download a daily copy of a MySQL database. I'd prefer to send it over 
> ssh, so I'm thinking of something like this:
>
> ssh me at server.com "mysqldump db_name -u me --password=secret | gzip 
> -c" > sql-backup-2006-06-18.gz
>
>
> This would work except that I still need to type the ssh password. Is 
> it possible to specify the ssh password in the command line? Or do 
> something else so I can run this on a script?
>
> Cheers,
> Daniel.

I used the SSH howto:

https://wiki.ubuntu.com/SSHHowto

and

https://wiki.ubuntu.com/AdvancedOpenSSH

to set up RSA keys between my two boxes.  There is a section in there 
about using RSA keys for auto-login/backup operations.  I believe the 
setup will be a little more secure than the password system, and would 
work inside your script.

-Matt





More information about the ubuntu-users mailing list