- I create a user named "TEST"
- I want him to be able ONLY to be in ../var/www/
- He can't move from it, he can't do anything outside of the folder.
- And also I want him to do this through FTP, he will be automatically moved to this folder and can't even go to /home or whatever just ONLY the folder what I specify.
Asked
Active
Viewed 547 times
2
Jeff Schaller
- 66,199
- 35
- 114
- 250
-
It depends on the ftp daemon you are using. If your "test" user should access the server only via ftp, you might make his home directory be `/var/www`, and have the ftpd make the user be placed in a `chroot()` jail (most ftpd implementations do allow this). – ridgy Mar 19 '17 at 14:37
-
See e.g. http://unix.stackexchange.com/questions/94603/limit-ftp-access-only-to-the-var-www-with-vsftpd – ridgy Mar 19 '17 at 14:43
1 Answers
1
User test need a home folder to store config files (example: /home/test/.bashrc which is bash configuration file)
What you can do is make him the owner of directory in /var/www and he will be the only one able to access it.
chown -R test /var/www/target-dir
You can them make a link from /var/www to its home folder.
ln -s /var/www/target-dir /home/test/
Then if he connect through ftp/sftp/ssh he will be logged into is /home/test directory that contain a link to the folder he can modify.
If you do not want this user test to have too much rights, do not make him a sudoer. If you want to protect an other user home folder from being red, you can do as follow
chmod o-x /home/other_user
zakrapovic
- 466
- 1
- 6
- 16
-
Comments are not for extended discussion; this conversation has been [moved to chat](http://chat.stackexchange.com/rooms/55674/discussion-on-answer-by-zakrapovic-prevent-user-from-reading-others-home-directo). – terdon Mar 20 '17 at 09:49