1

Ubuntu 16.04 Bash 4.4.20

I would like to know the steps involved in creating a unique user which the ftp server can use as a totally isolated unprivileged user.

NOTE:
In the vsftpd.conf file, there is the following:

# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=ftpsecure
  • By "totally isolated" do you mean that you want them confined to their own /home/them directory? Or confined to some group /var/ftpd/public directory? – user535733 Jan 5 at 15:58
  • @user535733 The user ftp server can use, not a user that uses the ftp server. – Curious Sam Jan 6 at 16:55
0

I tried to realize exactly that on my raspberry pi some time ago..

I dont remember exactly how I did that and cant find the "source" of my information anymore but it should roughly go in this direction:

Create a user without giving him an own home directory (ftp_user is his name, you can give him a different one):

sudo adduser ftp_user --no-create-home

(Here you should be able to give that user a password)

If you want ftp_user to be able to access a specific folder you need to

mkdir /path/to/specific/folder                    # create a folder
sudo usermod -d /path/to/specific/folder ftp_user # assign to ftp_user

Then you need to give that user the ownership of that folder

sudo chown ftp_user:ftp_user -R /path/to/specific/folder

And In general the rights for that special folder should be like this:

sudo chmod 774 -R /path/to/specific/folder    # You:rwx Group:rwx eveyone else: r--

or

sudo chmod 775 -R /path/to/specific/folder    # You:rwx Group:rwx eveyone else: r-x

In case the folder is in /var/www/.. it may be neccessary to add the user to group www-data or something like that (if I remember correctly there is a www-data group also)

What is the www-data user?

and of course chown that file respectively:

sudo usermod -G www-data ftp_user
sudo chown ftp_user:www-data -R /path/to/specific/folder

Same for your home directory, if you want to share your home folder with that ftp_user you should be able to add ftp_user in your group but then you shouldn't chown your home folder but disallow write executions for group and everyone else..

Be very cautious with the ownership of folders and permissions.

| improve this answer | |
  • It's the system user that ftpserver uses. I added additional info to my OP. I should have been clearer when I originally posted my question. – Curious Sam Jan 6 at 21:46

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.