0

Hope you all are doing fine.

Team I want to strict ftp user only for /var/www/html directory not to other's. Please share your valuable suggestion for that. I have checked lots of Blogs, Forums etc but not succeeded. I can create ftp user but user can go in any directory excluding root .. Please give me answer

Manoj
  • 19
  • 1
  • 2

2 Answers2

1

To restrict a FTP user to a specific directory:

  1. Create a new user with home directory set to the desired directory: sudo useradd -d /var/www/html -s /sbin/nologin ftpuser
  2. Set ownership and permissions of the directory: sudo chown -R ftpuser:ftpuser /var/www/html sudo chmod -R 755 /var/www/html
  3. Configure FTP server to use the new user and directory, specific steps vary by server software. For example: vsftpd Hope this will help!
0

It's called a chroot where you change the root of a filesystem for a specific user. Here's a great howto from unix.stackexchange.com

https://unix.stackexchange.com/questions/94603/limit-ftp-access-only-to-the-var-www-with-vsftpd

jbrahy
  • 168
  • 10