In my ubuntu 14.04 I installed the (FTPD) ftp server. I would like to create one user for that and set nologin to that user. When logging on using an FTP client, I want that particular user to be able to see the entire system directory.

How do I restrict one user like that to one directory (E.g. /usr/local/example)?


For vsftpd (“Very Secure File Transfer Protocol Daemon”), the configuration is exceedingly simple:

sudo apt-get install vsftpd


sudo nano /etc/vsftpd.conf

ensure you have the following parameters set right:

# Depending on the version you're running, you might want to set the following 
# parameter to YES 
# (if affected by https://bugs.launchpad.net/ubuntu/+source/vsftpd/+bug/1313450)
# to allow local users to log on:
#if you want write access too:
# Set anonymous user directory to /srv/ftp (no default)
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.

# following for debugging purposes (to ensure you're on the right server)
ftpd_banner=Welcome to Aravind's FTP service.

# Now restrict users to their home directories:

And now, if you want to set a particular user to a particular directory, just create a user with a particular directory:

sudo adduser ftpuser --home /usr/local/example

To test:

Go to a terminal on the machine running vsftpd and type: ftp and if you're greeted by your own banner, vsftpd works!

Then test on the same machine to its public address: ftp and finally from a remote machine to the public address. If something goes wrong with the public addresses, check your firewall settings.

Additional notes:

If you don't want the user to log on, add the --shell /bin/false parameter to the adduser command.

You might also want to delete all the directories/files (Desktop, Pictures, ... that the adduser created if you don't want them there...


  • 1
    Even after this, I am able to view other users home directory and all the contents in it :( Apr 30 '17 at 7:42
  • @DaveRanjan: Try again... c I went over my answer and cannot find any holes or Ask a new question, refer to this one and post any errors you encountered along the way.
    – Fabby
    May 7 '17 at 15:27

Is there a reason you need to use that specific FTP server software? What you're looking for is mostly called "chroot" (change the root directory per user) or something similar. According to this bug report the netkit ftp server, that's contained in the linux-ftpd package, doesn't offer that feature. Event the launchpad page says

This is the netkit ftp server. It is recommended for you to use one of its alternatives, such as wu-ftpd or proftpd.

I know from experience that pure-ftpd (setting VIRTUALCHROOT) and ProFTPd (by virtual hosts) offer the feature you're looking for. Both are available from the standard Ubuntu repositories. Other ftp server software probably offers similar features.


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.