How to make home directory the root with useradd on Debian

1k views Asked by At

I want to add a new user on a Debian server but I need to set, that it sees the home directory to be the root for security purposes.

e.g.:

new user: usr home directory: /home/usr root directory: /home/usr and it should not be able to go back to /home

Is there a way to do that using useradd? Or even manually?

1

There are 1 answers

6
ld57 On

No you cannot do that directly with useradd.

You have to play with chmod. For example you could revoke the 'read others' right in /home to block direcory listing.

Do not revoke the execute right or you won't be able to cd in users homes.

But if you want to put restrictions on users remotely connecting to your server, you may setup a 'chroot jail' for SSH access for example