FTP Confituration of SUSE Linux Enterpriser Server 11
File Transfer Protocol (FTP) is the easiest way to send and receive files over the network. Think of situations when you cannot send large files as attachments to some one. Even if you can, you never know that when that file / message will be sent and whether the other person's mail box was having enough room to accommodate your files attached with the mail message. Amongst many FTP servers, I will be discussing only the VSFTPD server in this section.
use #rmp -qa |grep vsftpd command to ensure that vsftpf server is install on your machine.
Something about FTP ports, Active mode and Passive mode FTP :
In Active mode FTP, the FTP server connects to IP and port announced by client, using server's FTP data port (20). In Passive mode FTP, the server assigns / opens port on the server, tell the client about it, and then let the client connect to the new port.
The FTP protocol first opens up a single connection that is called the FTP control session. When we issue commands through this session, other ports are opened to carry the rest of the data related to that specific command. These connections can be done in two ways, either actively or passively.
When a connection is done actively, the FTP client sends the server a port and IP address to connect to. After this, the FTP client opens up the port and the server connects to that specified port from its own port 20 (known as FTP-Data) and sends the data over it.
Passive FTP works the opposite way. The FTP client tells the server that it wants some specific data, upon which the server replies with an IP address to connect to and at what port. The client will, upon receipt of this data, connect to that specific port, from its own port 20(the FTP-data port), and get the data in question.
Server side configuration:
VSFTPD has the config file as /etc/vsftpd.conf, in SLES 11. This file is quite straight-forward to configure. The default configuration will allow any user to connect to this ftp server as anonymous.
Now Open vsftpd.conf configuration file
If you want to restrict anonymous logins then set the following directives in this file as below:
To enable local users to login to this FTP server, use:
Set up the welcome banner:
ftpd_banner=Welcome to FTP service at mydomain.com.
This will make sure that users cannot change directory outside their home directories: chroot_local_user=YES
Some other important directives are:-
local_max_rate = 7200
Now start the vsftpd server:
Client side configuration:
Nothing special is required. You can use any FTP client like: cuteFTP f/windows, gFTP f/Linux, or even ftp command from command line.
Now on client machine I try connect to the Server machine
Some Useful FTP related commands:
This lists the commands that you can use to show the directory contents, transfer files, and delete files.
This command prints the names of the files and subdirectories in the current directory on the remote computer.
ftp> cd Personal
This command changes the current directory to the subdirecotry "Personal", if it exists.
ftp> cd ..
Changes the current directory to the parent direcotry.
ftp> get image1.jpg
Downloads the file image1.jpg from the remote computer to the local computer. Warning: If there already is file with the same name it will be overwritten.
ftp> put image2.jpg
Uploads the file image2.jpg from the local computer to the remote computer. Warning: If there already is file with the same name it will be overwritten.
A '!' in front will execute the specified command on the local computer. So '!ls' lists the file names and directory names of the current directory on the local computer.
ftp> mget *.jpg
With mget you can download multiple images. This command downloads all files that end with ".jgp".
ftp> mput *.jpg
Uploads all files that end with ".jgp".
ftp> mdelete *.jpg
Deletes all files that end with ".jgp".
Turns iteractive mode on or off so that commands on multiple files are executed without user confirmation.
Exits the ftp program.