Im trying to create new user called svecias and give him permission to connect via SFTP only to existing directory and deeper (/usr/share/nginx/itsupply). Currently directory is owned by nginx in group nginx. How can I give new user access to this directory (without disabling access to this dir for nginx)? I tried adding newly created user to group nginx, but when Im trying to connect with credentials, Im still getting prompt to enter password (I guess user still doesnt have permission for his home directory).


cat /etc/passwd | grep svecias

gives me this result:


So this user has its home directory set as needed one.

before I did

usermod -a -G nginx svecias
usermod -g nginx svecias

result was:


1 Answer 1


According to this answer /usr/sbin/nologin will make your user unable to login via SSH.

Also, adding the user to nginx group will make it have access to any folder that this group has access, not only /usr/share/nginx/itsupply. In addition, files created by this user will be owned by svecias:nginx. This will probably be ok, but may cause trouble sometime.

In my server the solution I used was to mount the specific folder using bindfs and map the users. This is in my fstab:

/home/www /home/wwwbind fuse.bindfs map=www-data/cpd:@www-data/@cpd,create-with-perms=0770 0 0

This way, I log in using cpd user that has access only to /home/wwwbind. Any modification will be reflected to /home/www as if user www-datamade them.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .