Limit users only to their home folder and sub folder
I have been given access to SSH Access(bash) to my user and I want to restrain the user's login to their own home folder/sub folder. They can't allow to cd to home or higher.
I tried to use this cmd:
chmod o-x /home/*
But it only works if they access like normal FTP with File Zilla, if they tried to use the Bitvise SSH tool, they can freely go to the home directory and higher.
I hope to receive some hints, thank you.
My VPS: Debian - 10.10 running with MyVestaCP.
adduser --home /assigned/to/directory user_name
@sandeep I tried to apply it for the exists user so I can't get the adduser work, I got the message below:
Warning: The home dir /home/xxx you specified already exists. adduser: The user `xxx' already exists.
@designerresource you need to create new user. As CWP user will have full access to /home/user dir.
@sandeep maybe you misunderstand my question. I want the user can't cd home when they have ssh access.
They must able to cd in: /home/$USER only.
- Allow: cd /home/$USER/xxx
- No allow: cd /home or cd /
I'm not sure if it's possible or not.
Thank you so much for your support.
@designerresource by default it is restricted to
/home/userif your server have issues use our support portal for the fix.