0

Suppose I have a home directory called "website".

I want to create an sftp user to access that home folder and the sftp user is going to have a less obvious user name. There may be quite a few users like this so I am wondering if I can create these new sftp users without a home directory of their own and send them to the "website" directory.

I tried this by using usermod -m -d and then deleting the new users home folder but got access denied when logging in.

7
  • Do you change the homedir of the users to the website dir ?
    – Dom
    Dec 4, 2014 at 17:46
  • While the name of the home directory is typically the same as the username, there's no rule requiring it to be. The name of the directory is irrelevant. Are you really trying to ask how to share the same home directory with multiple accounts?
    – user143703
    Dec 4, 2014 at 19:26
  • @Dom yes that is what usermod -m -d does
    – Kline
    Dec 4, 2014 at 20:17
  • @yoonix this is what I thought but deleting the home directory of the sftp user seems to cause a problem. I can login to "website" via the new user but only if their home folder exists.
    – Kline
    Dec 4, 2014 at 20:30
  • Right, you would make the website directory the home directory. That's why I'm asking if you are trying to share the directory. If it's just one user, make his home directory /whatever/you/want/website. If you need to share that directory between accounts, that's something else entirely.
    – user143703
    Dec 4, 2014 at 20:42

1 Answer 1

1

Groups!

addgroup yourgroup

chgrp yourgroup /some/dir

Add the users you want to share this directory to the group.

usermod -g yourgroup user1
usermod -g yourgroup user2

Give group proper permissions to /some/dir. 775 is just an example.

chmod 775 /some/dir

Assign /some/dir as the home directory for your users.

usermod -d /some/dir user1
usermod -d /some/dir user2

Voila.

You must log in to answer this question.

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