Installing and configure vsftpd on Ubuntu or Debian whit dedicated folders.
First install VSFTP onb your server:
How to configure vsftpd:
sudo apt-get install vsftpd
Now that youíve installed vsftpd, follow this procedure to configure it.
Before you get started, stop the vsftpd by typing:
Edit the vsftp.conf
service vsftpd stop
Make the following changes:
# sudo vim /etc/vsftpd.conf
We donít want anonymous login:
Enable local users:
The ftpuser should be able to write data:
Port 20 need to turned off, makes vsftpd run less privileged:
set umask to 022 to make sure that all the files (644) and folders (755) you upload get the proper permissions.
Now that basic configuration is complete, now let us begin with locking / securing a directory to user.
For the second user it's pretty much the same but you but changing his home folder to a filder whitin user1's homefolder (dir2 is your software folder):
sudo useradd -d /path/to/your/dir/user1/ -s /usr/sbin/nologin user1
sudo useradd -d /path/to/your/dir/user1/dir2/ -s /usr/sbin/nologin user2
Setup a password for the users:
In order to enable the user1 read and write the data in your home dir, change the permission and take ownership, We will give the user ownership now, but later into the guide we will create a gruop that we well add user2 in:
sudo chown -R user1 /path/to/your/dir/user1
sudo chmod -R 745 /path/to/your/dir/user1
Create userlist file and add the user:
and add the user you want:
sudo vim /etc/vsftpd.userlist
save the file and open the vsftp.conf file again:
Add the following lines at the end of the file and save it:
sudo vim /etc/vsftpd.conf
After completing all these procedures it is almost ready to use it, give it a try but you will get a 500 OOPS permission denied error. To fix it you need to add a nologin to the shell set.
# the list of users to give access
# this list is on
# It is not a list of users to deny ftp access
sudo vim /etc/shells
The file should look like this:
Add this line at the end:
Now create a usergroup and add the the users to it who will have access to :
sudo addgroup gruop1
Asol dont forget give rights to the gruop users (that user2 is in) for user1's folder and files, because you wanted the "Software" would be owned by user1 but be user2's home directory
sudo usermod -G gruop1 user2
Now start the vsftpd:
sudo chown -R user1:gruop1 /path/to/your/dir/user1/software
Thatís it. Now you have a secure installation of vsftpd on your server.
sudo service vsftpd start
If this does not help, send me a pm and I can help you over skype.