Many times, when working on a linux server, I have found that typing in my password over and over gets annoying. So, I have created a public key, put it on my mac, then upload that key into my auth hosts file on the server and bam! no more typing in my password.
Yes, I know, there are security risks. But I figure, if you know my password to get onto my box, you will most likely know my server passwords, so you deserver it anyway.
Below is an example I have put together (or took from a friend).
To create a public key, follow the following instructions:
- Add users
adduser chuck - Setup the new group
groupadd dev - Update the users for the dev group
usermod -g dev chuck
usermod -g dev apache
usermod -g dev root
Set up passwordless SSH tunnels from your box to server
Configuring No-Password Operation
- On the SSH client system and as the user:
ssh-keygen -q -t rsa -f ~/.ssh/id_rsa -C ‘’ -N ‘’ - Copy the ~/.ssh/id_rsa.pub file from the client to the user account on the ssh server.
scp ~/.ssh/id_rsa.pub username@ipaddress:id_rsa.pub - On the SSH server and as the user.
mkdir ~/.ssh
chmod 0700 ~/.ssh - On the SSH server as the user, type the following command: (some systems use authorized_keys2 rather than authorized_keys)
% cat ~/id_rsa.pub >> ~/.ssh/authorized_keys - On the SSH server as the user, verify that the keys file has appropriate permissions.
chmod 0600 ~/.ssh/authorized_keys
