Ubantu does not come directly with the FTP server installed, you first need to install a ftp server. I have opt for the vsftp server, there are some other choices which you can explore. Once you run this command it will connect to internet and will download and install the vsftp server.
sudo apt-get install vsftpd
Now once its installed its better to have a copy of the configuration file, it wil help if any corruption in the file.
sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.orig
Now open this file and add the following content to make it working for the user list you want to work, and run the command to allow connection from 20 and 21 from outside. Otherwise firewall will block it.
vim /etc/vsftpd.conf
and add following
userlist_file=/etc/vsftpd.userlist
userlist_enable=YES
userlist_deny=NO
pasv_enable=Yes
pasv_min_port=10000
pasv_max_port=11000
user_sub_token=$USER
local_root=/home/$USER/ftp
userlist_enable=YES
userlist_file=/etc/vsftpd.userlist
userlist_deny=NO
sudo systemctl restart vsftpd
ufw allow from any to any port 20,21 proto tcp
Now add the ftepdemo user. -m in the below command ensure that this user created with home directory.
sudo useradd -m ftpdemouser
Now set a password for this user and remember it.
passwd ftpdemouser
Create following directory and change the permission to get the access.
sudo chown nobody:nogroup /home/ftpdemouser/ftp
sudo chmod a-w /home/ftpdemouser/ftp
sudo mkdir /home/ftpdemouser/ftp/test
sudo chown ftpdemouser:ftpdemouser /home/ftpdemouser/ftp/test
sudo systemctl restart vsftpd
Once information filling complete, please use host name, for the connection. it will give the directory for you. Upload a file and enjoy.
Please let me know if you face problem in anytime.
No comments:
Post a Comment