We’ll be installing vsftpd (Very Secure Ftp Daemon), a stable, secure, and fast FTP server. The most known and widely used are PureFTPd There are several open-source FTP servers available for Linux. Keep coming back.This article describes how to install and configure an FTP server on Ubuntu 20.04 that you use to share files between your devices.įTP (File Transfer Protocol) is a standard network protocol used to transfer files to and from a remote network. I hope you find the post useful and interesting. The FTP server is one of the easiest servers in Linux to configure and work with. There are two modes for file transfer when using FTP server, ASCII mode, and binary mode, you can change the mode like this: ftp> binary Or you can delete a directory from the server using the rmdir command. You can create a directory using the mkdir command: ftp> mkdir dirName To upload multiple files, use the mput command: ftp> mput file1 file2 Use put command to upload a file to the server: ftp> put filename Use delete command to delete a file from the server: ftp> delete filename You can download a file using the get command: ftp> get myfileĪlso, you can download multiple files using the mget command: ftp> mget file1 file2 You can change the local directory using the lcd command: ftp> lcd /home We use the lcd command to display the local folder, not the FTP folder: ftp> lcd If you want to exit your FTP session, use the bye command: ftp> bye You can list files using the ls command: ftp> lsĪlso, you can use the cd command to change the working directory: ftp> cd / The first command is the pwd command, you can use it to print the current working directory: ftp> pwd You can use any GUI client to upload and download your files, but you need to know some FTP server commands also. The file /etc/vsftpd.chroot_list contains the list of jailed users one per line. Open /etc/vsftpd/nf and uncomment the following options: chroot_local_user=YES You can secure your FTP server by jailing your FTP users in their home directories and allow only specific users to access the service. If you are using a firewall, you should choose SFTP, since it needs only one port. The FTP server will use this port for all connections during FTP sessions. The best solution, in this case, is to use SFTP (FTP over SSH). However, with the tightly secured firewall, it is difficult to manage this kind of connection since FTPS uses multiple port numbers. In the last example, we saw the FTP over the SSL layer (FTPS), and we’ve successfully connected to the FTP server. Try to connect to your FTP server from any client on any system like Windows and choose the secured connection or FTPS, and you will successfully see your folders. Restart your service to reflect these changes. Rsa_private_key_file=/etc/pki/tls/certs/ftp.key Rsa_cert_file=/etc/pki/tls/certs/mycertificate.crt Open / etc/vsftpd/nf file and add the following lines: ssl_enable=YES Now, all we need to do is to configure vsftpd to support secure connections. $ cp mycertificate.crt /etc/pki/tls/certs Now we copy the certificate file and the key and to /etc/pki/tls/certs: $ cp ftp.key /etc/pki/tls/certs/ $ openssl rsa -in -out ftp.keyįinally, we generate our certificate: $ openssl x509 -req -days 365 -in certificate.csr -signkey ftp.key -out mycertificate.crt Now we remove the password from the key file: $ cp FTP.key $ openssl req -new -key FTP.key -out certificate.csr When you need to transfer a file, the remote FTP server will open port 20 to connect to the FTP client.Īctive mode connections usually have problems with firewalls, TCP ports 20 and 21 should be open on your firewall.īecause of these problems with firewalls of active mode, we can use the passive mode. You can check your ephemeral port range using this command: $ cat /proc/sys/net/ipv4/ip_local_port_range The client connects from a random ephemeral source port to the FTP control port 21. When the FTP client starts a transfer, there is an option on your FTP client that controls whether you want to use active or passive FTP connection. Passive connections initiated by the client to the remote server, and the server waits for requests. When you transfer a file, the data connection starts.Īctive connections are initiated by the remote server, and the client waits for server requests. When you establish an FTP connection, the TCP port 21 opens to send your login credentials this connection is called control connection.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |