1
  • 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.
  • 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. unix.stackexchange.com/questions/94603/… – ridgy Mar 19 '17 at 14:43
0

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
  • Comments are not for extended discussion; this conversation has been moved to chat. – terdon Mar 20 '17 at 9:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.