Managing so many WordPress websites, dealing with Terminal & command lines is inevitable. I use Mac OS X, so Terminal app and SSH command are the tools get me connected with remote machines occasionally. Although Coda 2 is my main code editor, FTP client & Terminal app, there is time I like to pop up the simple Terminal app, and use few command lines for a quick checkup.
Generating an ssh key pair in Linux is really simple. It only involves one single command called “ssh-keygen”. The settings within 'config.ssh' relate to configuring how Vagrantwill access your machine over SSH. As with most Vagrant settings, thedefaults are typically fine, but you can fine tune whatever.
Instead of using standard SSH command line like this:
and then be asked for password every time. I find using private SSH key is much easier and safer without worrying about password. Because I managed so many websites, and there is no way I can remember those lengthy weird passwords without copy & pasting from some secret documents, which slows down my work.
In Mac OS X, we can use SSH Client Configuration file to achieve this. First, we start the config file in editor:
vi ~/.ssh/config
Add the following settings for the site:
Host site-alias
Hostname server.domain.com
User username
IdentityFile ~/.ssh/id_dsa
Hostname server.domain.com
User username
IdentityFile ~/.ssh/id_dsa
This is to tell SSH client to login to server.domain.com as user “username”, using private key file id_dsa as authentication. id_dsa is the private SSH key file obtained from CPanel @ server.domain.com. (If you want to know how to get a private SSH key file, please refer to “How to Setup SFTP Connection with Private SSH Key in Coda 2“).
With this configuration, I can use simple command like this:
ssh site-alias
Ssh Config Use Private Key
to connect to server.domain.com without typing in user name & password.
For the first time using the private key, system will ask you for the key password.
![Ssh Config Use Key Ssh Config Use Key](/uploads/1/1/8/9/118945881/856947951.png)
Ssh Config Use Keychain
Choose “Remember password in my keychain” if you don’t want to be asked for password every time.