1

I created a user on Centos 7 via webmin and pointed /var/www/html/ page as their home directory so when they log in they start from there.

However, I logged in myself and realized that they can navigate from there to the upper directories which I don't want. How can I prevent this from happening?

Thank you.

1

You will need to find a feature specific to the ftp server you are using that could create a chroot-like environment. Some examples are:

  • proftpd: DefaultRoot. This option will have to point what is the chroot dir of a server.
  • pureftpd: -A option. Quoting the documentation

This feature is called "chroot". You can enable this by running pure-ftpd with the "-A" switch to do this with ALL your users (but root) .

  • vsftpd: chroot_local_user=YES will chroot to default user home. There is already a good answer here.
  • its weird but I didnt install any ftp server so I dont even know how come I am able to FTP access. – Cain Nuke May 25 '17 at 16:55
  • As pointed out by @ivanivan, the default ftp server on webmin should be proftpd. It is just a matter of finding the configuration file and put a line like DefaultRoot=/var/www/html/ on it :) – user34720 May 25 '17 at 16:59
  • But that one is stopped right now and Im still able to access. Is that normal? – Cain Nuke May 25 '17 at 17:09
  • netstat -tapn | grep 21, and see what is the process that is LISTENING on this port(21/tcp - ftp) – user34720 May 25 '17 at 17:11
  • I see nothing on port 21, the user is on port 22. – Cain Nuke May 25 '17 at 17:22

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.