Infolinks

Breaking

Adsense

Tuesday, March 27, 2018

Create SFTP User and Limit Access to Specific Folder Ubuntu

I happened to encounter a situation in the past wherein I needed to add another SFTP/SSH user and limit its access to a specified folder. Since I don't have any cpanel to easily manage users, my only option is to do it from terminal/konsole.

So below are the steps to do it.

STEP 1: Access using putty
Access your server using putty or from terminal using ssh. I've been using putty to easily access my remote servers since it allows you to create profile on each instance.

It will look something like on the image below.


or you can do it something like this from your terminal/konsole.
ssh username@IP

It will require you to enter your password, just enter your password and hit enter.

STEP 2: Add group for sftp users
groupadd sftpusers

STEP 3: Add your user to group and specify the folder that it is allowed to access.
sftpusers is your groupname and /var/www/test is your default directory for dev user


useradd -g sftpusers -d /var/www/test dev

STEP 4: Change ownership of folder mine is from user root to dev user.

chown -R dev:sftpusers /var/www/test

Just in case you want to modify your user just copy and change the code below.
usermod -g sftpusers -d /var/www/test dev


Feel free to post for your comments or suggestions. I'm an amateur systems admin and still learning. Thanks ^_^

Create SFTP User and Limit Access to Specific Folder Ubuntu

No comments:

Post a Comment

Adbox