Here’s a handy little utility for automatically sending your SSH password when connecting to your server via SSH with a Bash Alias shortcut.
Rather than having to type
ssh firstname.lastname@example.org /*where 220.127.116.11 is the servers IP*/
and then manually entering my password, which if you’re anything like me you’ll have to search for. You can simply set up a list of shortcuts in your .bash_profile file to speed up access.
For example, I’ve have four SSH shortcuts setup for different servers which allow me to SSH into them by simply typing
The first thing you need to do is install the sshpass utility:
brew install https://raw.github.com/eugeneoden/homebrew/eca9de1/Library/Formula/sshpass.rb
Now it’s just case of adding your shortcuts to your .bash_profile file. Edit your bash_profile file with your favourite editor (I use nano):
and add a shortcut:
alias myshortcutname='sshpass -p 'PASSWORD' ssh root@SERVER_IP'
You can then quickly SSH into your server by typing myshortcutname in terminal.