ssh without a hostname and password
15/06/2011Often I have to login to different machines. It’s annoying to always type the full hostname and then password. So here is what you can do to avoid typing too much:
1. On your local machine create a private and public key:
by default 2 keys will be created (id_rsa, id_rsa.pub) under ~/.ssh
2. Create config file under ~/.ssh
3. Add your connection information to config file:
Hostname HOST_NAME # example.com
User USERNAME
port PORT
4. Create .ssh folder on the remote machine from your local machine (you will be prompted for the password):
5. Finally append your new public key id_rsa.pub to ~/.ssh/authorized_keys on your remote machine (you will be prompted for the password one last time):
That’s all! Now every time you want to login to your remote machine you can type:
and you should be able to get in.