Save SSH password for use in “Terminal” (OSX)
Make aliases in my
file, which gets executed everytime you start your Terminal window (so it’s a good place to put your shortcuts and any code you wish to execute when the terminal starts, such as paths).
Start the Terminal.
Open the profile file for the current user (you).
Enter a new line for our shortcut.
alias s='ssh -2 -p 22 firstname.lastname@example.org'
Quick explanation for that command in step 3. The letter “s” is the shortcut I make for connecting to the sniptools.com server. Change it to what you wish. This will mean that when I start Terminal, all I need to do is type “s” and it connects me via SSH to the sniptools.com server. The “-p” switch is an important one because some of us with paranoid security settings might have a different port number than the default port 22 for secure SSH. The rest user/host stuff is self-explanatory. The “-2” is to force SSH2 connections instead of older vanilla SSH.
Now. Save the profile file and source it to try it out:
Sourcing is only for this one time, for your current Terminal window, which had already executed the profile file *before* we added this alias. When you start a new Terminal session, these aliases et al will be automatically set for you.
Done. Now your profile has the alias for “s”. From now when you type “s” in your Terminal, it will connect, but it will ask you for a password.