How to Install FTP on Ubuntu
In this tutorial we can learn how to install FTP on Ubuntu
What is FTP
FTP is a client server protocol that allows two communication channels between client and server. Using a FTP client we will be able to upload, download, and delete the files on the server. Initially, the client needs to authenticate the FTP server. The FTP session will work on both passive and active modes. Active is the default mode for FTP. In active mode connection, when the client starts to make the initial connection, the server initiates the second connection and enables data transferring to the client. In passive connection, the client connects and sends the PASV command to the server. Then the server sends the port number to the client.
We can access the FTP server by both Anonymous and Authenticated way. In Anonymous mode, the client can access the FTP by using a default username called “anonymous” or “FTP” and email address as password. In Authenticated mode, client should have their own username and password to access the FTP server.
Steps to install FTP
Before starting installation, we need to update the repositories.
# apt-get update
Install VSFTPD package using below command.
# apt-get install vsftpd
If you wish to enable anonymous mode in FTP, then you need to edit /etc/vsftpd.conf by changing.
A default ftp user will be created automatically during the FTP installation time and the home directory of the user will be /srv/ftp.
To allow local users to login, edit the /etc/vsftpd.conf file by changing.
To grant local users to write to a directory change the write_enable setting to YES.
Local users can be limited to their home directories by uncommenting.
and add the following line at the end of the file /etc/vsftpd.conf.
To enable passive mode, add the following lines to /etc/vsftpd.conf.
Restart VSFTPD service to enable all changes made by using the below command.
# service vsftpd restart
Users that are disallowed FTP access will be listed in a file called /etc/ftpusers. To disable FTP access for a particular user then you can add the username to /etc/ftpusers file.
Now create an ftp user by using the following command.
# useradd -m username -s /usr/sbin/nologin
# passwd username
Now you can connect FTP server on port number 21. Connecting via port 21 poses a security risk. Please configure SFTP for more security.
Secure FTP which is also called SSH File Transfer Protocol is a protocol for accessing and managing files in a remote file system.
1) Install openssh server package using below command.
# apt-get install openssh-server
2) Create a new group for FTP users.
# groupadd ftpaccess
3) Add the following lines to /etc/ssh/sshd_config file.
Subsystem sftp internal-sftp
Match group ftpaccess
Comment the below line in /etc/ssh/sshd_config file.
Subsystem sftp /usr/lib/openssh/sftp-server
4) Restart ssh service using the below command.
# service ssh restart
Restart vsft service using the below command.
# service vsftpd restart
5) Add the ftp user to the ftp group by using the below command.
# usermod john -g ftpaccess -s /usr/sbin/nologin
Now you can able to connect FTP server using port 22.
If you need any further assistance please contact our support department.