Normal User SSH Access For Developers

Normal User SSH Access For Developers

         In this article, we are going to check how to provide or create normal user ssh access for developers?
With the help of normal user ssh access, developers can able to access Codebase on a production server. They only have access within the Codebase area.

They only have access within the Codebase area.

In today's world, every change made on production server's using git only and providing production server access to developers is little risk.

When they want to pull any changes on production server they need to come to you and asked to take git pull on a production server.

In this case, better to provide normal user ssh access on a production server for taking git pull on a production server. It also helps developers to work smoothly on the server.

We have articles on SSH which gives you the idea to secure production server. For this go through the below links,

 

READ : Set Email Alert SSH Login On Linux Server

 

Let's check the step-by-step process to create normal ssh user on a Linux system.

1. Create devgit user

Here we are going to create a user with "devgit" and providing Key Based authentication access on the server. Key based access prevent the other user to use the credentials to login to the server.

Details of User which we are creating:

# Username: devgit
# Password: Key-based

Use below command to add User on the server.

$ useradd -m -s /bin/bash -g nginx devgit

We have created a user with devgit and added it to the Nginx group.

2. Add SSH Key of Developer

Now we are going to add SSH key of developer machine on production server under the devgit user. If developer doesn't have ssh key then create it on developers system using command,

$ ssh-keygen
$ cat .ssh/id_rsa.pub

For complete guide on SSH key based authentication read below article,

 

READ : 5 simple steps for key based authentication SSH

 

Copy the SSH Key of Developer system and paste in "authorized_keys" file.

Follow below steps,

$ cd /home/devgit
$ mkdir .ssh
$ touch .ssh/authorized_keys
$ chown -R root.nginx .ssh
$ chmod 750 .ssh
$ chmod 640 .ssh/authorized_keys

3. Add Developer SSH key

Use below Echo command to insert ssh key in "authorized_keys" file.

echo -e "## ALe8RQpB07Wm3nHufiIIdRCK3XlS7D0s3lSi8ICrs8WGInc9y+XmVDlwKa6+XEp8zXvJQN6bGX8rP/27et1+Id4YyNnUJ8WGxgCH9k5E2U+CtRTbSs/P8zEfKwciNS74SwORx6R45PRS1N0l3LRBrJOJ6nPr8fSX+/B+/AKinyXv6V8SyOSO36B+r5CRbbkWM6wP Developer-email-id" > /home/devgit/.ssh/authorized_keys

4. Set Permission using sed command

With help of "sed" command add umask of 022 which means the devgit user will have read,write access to the codebase.

$ sed -i 's:^#umask 022:umask 002:g' .profile

5. Change Codebase Permission

Now change the user of Codebase to devgit so developers will be able to access files from Codebase area.

$ chown -R devgit. /Docroot/Codebase

This is the simple way to create normal user and provide SSH access for Developers. I hope you like the article if you find any difficulties in creating normal user on linux then please do comment your queries or problem via the comment section, till then stay tuned to techthings.org for more such valuable articles.

Leave a Reply

Your email address will not be published. Required fields are marked *