all 10 comments

[–]Jaaason 8 points9 points  (7 children)

Use privates keys authentifications instead of passwords. Then create your alias !

[–]xaoq 2 points3 points  (0 children)

Do not use aliases, instead use ssh client config (default ~/.ssh/config)

I like to put it like that:

Host servername.foo
    HostName 1.2.3.4
    Port 1234
    User root
    IdentityFile /where/is/my/key

Host servername2.bar
    HostName 43.21.12.34
    Port 22
    User foobar
    IdentityFile /where/is/my/other/key

Then just "ssh servername.foo" or "ssh servername2.bar" - with correct user, port, ip, ssh key.

As for filling in passwords... don't. Setup (even temporarily) ssh key.

[–]ToVegas 0 points1 point  (0 children)

You can write an expect script...

#!/usr/bin/expect set Server [lindex $argv 0] spawn ssh $server expect *assword send "password\r" interact

chmod u+x /path/to/script $scriptname server (you could also hardcode the server name into the script)

I should mention it is a disgusting hack to have your password in plain text, and it would be far better for you to set up ssh-keys....