How to create ftp user with access to subfolder in the another user's home directory?

December 29, 2014 7.1k views

I have some user, for example, “example” :) And his home directory is /var/www/example/, where are sites folders (/var/www/example/ For ftp access I use this user’s login “example” and his password.
But. I need to create another one ftp user, with access to the folder /var/www/example/ and only to this folder.
I can’t create a unix user with such home directory. Is there a way to resolve this problem?

2 Answers

Actually, you can create a user with /var/www/example/ as its home directory:

adduser --home /var/www/example/ --group username

Indeed. I just tried to use already existing directory as home, that’s why it didn’t work.
Thank you.

  • Interesting. Assuming you have both users in some common group, and you made the first parts of the path be executable only by the group, i.e., no read/write group, can you just then create a link to the new subdirectory from /home?

    So, /var/www/example/ will have path permissions of user rwx, group –x, others —. Then create /var/www/example/ be owned by your newguy account with rwx permissions for newguy. Finally, your newguy’s home folder will be a soft link from /var/www/example/ to /home/newguy

Have another answer? Share your knowledge.