Unix : SSH server add new user’s ssh keys

You have not chosen to deploy your application to fancy web hosting services like Engineyard, Digitalocean, or Heroku then you might be willing to know how to give other developers collaborating in this project access to the server via SSH. In other words you want to let others to deploy the application via SSH (eg. Capistrano).

Well, its pretty much simpler than you have thought.  Follow the steps

  • Copy the public key of your colleague to clipboard ( Ctrl + C )
  • SSH into the server
  • If you want to use the same username for all developer (say `deployer`)
    • $ cd /home/deployer/.ssh
      $ sudo nano authorized_keys
    • Paste the SSH public key of your colleague at the end of the file
    • Save the file
    • And you are Done!
    • Now your colleague should have access to the server
  • If want a separate username for every individual
    • It would be great if you create separate user-group for deployment purposes like `deployers`
    • create a new user in that group with privileges you like
      • to give sudo access you need to update the sudoers file
      • The configuration file for sudo is /etc/sudoers
    • goto that particular user’s home directory
    • add his ssh public key to the /home/user/.ssh/authorized_keys file
      • the .ssh folder might not already be available, you can create though
      • $ mkdir /home/user/.ssh
      • copy the content using `nano or echo`  into the file
    • Now you are Done!

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s