How to install vsftpd on linux ?


Vsftpd installation and configuration


Install

apt-get install vsftpd

After installing, the server starts automatically and listens on TCP port 21 by default.

We can check it within netstat  and also check the /etc/passwd and /etc/group and also take a look of ls l /srv.









Enable anonymous.



Addusers.

To add the user we have to use this command
adduser mortadelo
adduser filemon.

Create a  3 files in /srv/ftp
touch file1.txt

and also in users home.

From other system try to connect the ftp server
ftp and ip address


then try to download the files that we have created before
get and filename




Now go back to server and check the /var/log/vsftpd.log. In this directory we will find the all process that was done by client.
As I first tried to download a file which does not exists in the ftp and then I tried to download the other which exists in the ftp.
So as in the image we can see that first try was failed and another was successful.



Basic configuration vsfpd


Allow connection to Local-users:

Go to the vsftpd configuration file and uncomment the line and also write the yes.




Allow Local-users to download and upload the files:
Go to the vsftpd configuration file and uncomment the local_umask line.


Keep in mind that after every change in the configuration file need to restart the service.

service vsftpd restart

we also have to uncomment the line chroot_local_user=YES




After that we have to to add some line to upgrade the and update the vsftpd because without this we can't enter through localuser and can't create the directory.


echo "deb http://ftp.us.debian.org/debian jessie main contrib non-free" >> /etc/apt/sources.list
aptitude update
aptitude upgrade vsftpd
echo "allow_writeable_chroot=YES" >> /etc/vsftpd.conf
service vsftpd restart

Now enter through a localuser and try to create the directories. This time it will give the permision to connect and create the directories.

Activity:
Do that user mortadelo can change the directory but filemon can't?

We need to add the ftp user in to chroot list with command echo.
echo mortadelo >  /etc/vsftpd.chroot_list


By doing this we can see that user mortadelo is in now /home/mortadelo.


 
Mode passive


Beside the pasv_enable=YES, specify a port range in which VSFTP will run PASV mode:
pasv_min_port=50000
pasv_max_port=50999
port_enable=YES


Don't forget to configure iptables allows packet transmission on these ports:

iptables -I INPUT -p tcp --dport 50000:50999 -j ACCEPT

now restart the service and from client login to server ftp and after that write passive


Comments

Popular posts from this blog

How to install coWPAtty 4.6 on Ubuntu?

Alpine

How to get the user name and password of Facebook with DNS spoofing ?