Creating ssh user and provide permission only to a specific folder

creating-ssh-user-provide-permission-only-a-specific-folder

Creating ssh user and provide permission only to a specific folder

Creating ssh user and provide permission only to a specific folder
This process is simple and easy.

First You need to login to your vps or dedicated server.

Once logged in, create a user by the below command and set password for the created user.
eg. earneasy is the username we are creating here.

Now, we will change the folder permission so the user can create, delete or modify the files in the directory.

Now change the ownership of the folders, so this user can access the folder.

You can also set the directory to open, when you connect through a shell access.
This can be accomplished by editing the shell configuration file.
Which can be found at /etc/ssh/sshd_config

Use nano text editor and open the file.

and add the below lines.
Match user earneasy
ChrootDirectory /home/directory-name/public
Subsystem sftp internal-sftp

Press CTRL + O and CTRL + X to save and exit the file.

Once you saved the file, You should restart the ssh service to take effect.

IMPORTANT :
While you doing this make sure, You have another session live, incase you did something wrong you can always revert back and work again.
make sure you take backups of the config file.
eg.

Do give us your feedbacks and queries on the comments section, I will be happy to address.

About ilangovan ramasamy

I am a IT manager on a Corporate co. Started My Career In a Internet Center. having 10 years on Experience on IT. Very much Interested in knowing New technologies & gadgets. Wrote many Articles & how to’s for Computer Related issues. As I am in to hosting industry We face many issues on work. I thought of sharing my knowledge with you and writing so. If you guys feel something is interesting & helpful, Please do comment on it.

View all posts by ilangovan ramasamy →

Comments

This site uses Akismet to reduce spam. Learn how your comment data is processed.