Skip to content

Install FTP Server on Linux

FTP SERVER

The File Transfer Protocol (FTP) TCP is a protocol, allows us to upload and download files, works according to client / server. It continuously listens on port 21 TCP connection requests from remote clients, when it receives a request is handled by, establishes the connection and execute commands sent by the client.

Access to an FTP server can be done two ways:

● anonymous.
● Authenticated.

Installing vsftpd.

A variety of FTP servers to GNU / Linux, but vsftpd is elected as very easy to configure and is a more secure FTP server. In order to install the vsftpd server will do the following.

root @ server1:~#aptget update
root @ server1:~#aptget install vsftpd

As you finish downloading and installing the packages we have to do several steps to run your FTP server.

Create Group.

Now we have to create a group which controls the vsftpd service as follows:

root @ server1:~#groupadd ftp

Creation of home.

We have to create the deposit or the home where the user will accommodate your information, when finished installing vsftpd server creates a folder at home being as follows

/home/ftp, but you can have your users in other paths such as / var / ftp.
root @ server1:~#mkdir /home/ftp/rodmen

Creating FTP shell

What we do is create a virtual or phantom shell, so that users can not connect to a session of the operating system.

root @ server1:# Mkdir ~ / bin / ftp

As we see,Now we need to edit the following file.

root @ server1:~#vim /etc/shells
Add to end of / etc / ftp.
/bin / bash
/am / rbash
/bin / ftp

Creating FTP users
To create users for our service ftp command takes the following.

root @ server1:~#useradd g ftp d /home/ftp/rodmen s /bin/ftp rodmen

We need to add a password to our user created.

root @ server1:~#passwd rodmen
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
root @ server1:~#

Now we have to give permission to the user to be the owner of the deposit.
root @ server1:~#cd /home/ftp
root @ server1:~#chown rodmen.ftp rodmen/ R

Configuration Files

The server has two vsfptd important configuration files: /etc / vsftpd.conf This is the configuration file from your FTP server: /etct / vsftpd.chroot_list List of users who will be caged.

Vsftpd Configuration

At this point we begin to set our server vsftpd. Before I highly recommend it to create a backup configuration file:

root @ server1:~#cd /etc
root @ server1:/etc # cp vsftpd.conf vsftpd.confori

Begin to edit the service configuration file vsftpd.conf.

root @ server1:/etc#vim vsftpd.conf

In the file we have to change several parameters:

Parámetro anonymous_enable

Disable anonymous access to users, for safety.
anonymous_enable=NO

Parámetro local_enable

Allow authenticated users have their own local folders, we take the # to activate.
#local_enable=YES
local_enable=YES

Parámetro write_enable
Allow the writing mode in your wallet, we take the #.

#write_enable=YES
write_enable=YES

Parámetro local_umask

We allow this parameter to a mask it with some special permissions when getting information

#local_umask=000
local_umask=037

En this case we indicándole al parameter, will have rwx permissions for the user, r– for the group and — other permissions.

Caging FTP users

Caging enabled users within your home directory and to access their folders via FTP.

#chroot_local_user=YES
#chroot_list_enable=YES
chroot_local_user=YES
chroot_list_enable=YES

We enable the next line still sends for file, This file will have to create and within this add accounts
the user caged.

#chroot_list_file=/etc/vsftpd.chroot_list
chroot_list_file=/etc/vsftpd.chroot_list

When you finish configuring the file vsftpd.conf

root @ server1:/etc# touch vsftpd.chroot_list
root @ server1:/etc # echo "rodman">> vsftpd.chroot_list

Control of the bandwidth

You can add more options to the end of.

anon_max_rate = 5100 # Bandwidth for anonymous user 5kb.
local_max_rate = 5100 # bandwidth for local users 5kb.
max_clients = 3 # Maximum number connected clients.
max_per_ip = 2 # Maximum number of connections per ip.

Restarting FTP server

We just have to restart the vsftpd service to load the changes we have made to the server.

root @ server1:/etc#/etc/init.d/vsftpd restart
• Stopping FTP server: vsftpd [OK]
• Starting FTP server: vsftpd [OK]

FTP Commands
To now use our FTP server using commands serious, why is the list of ftp command and its description.

COMMAND DESCRIPTION

CD [rutaRemota] Change directory on the remote server
lcd [rutaLocal] Change directory on the local computer
chgrp [grp] [rutaRemota] Change the working group of a remote file.
The [grp] have to be a Group ID
chmod [options] [rutaRemota] Change the permissions on Reading, Writing or
Running a remote file
chown [own] [rutaRemota] Change the working group of a remote file.
The [own] have to be a User ID
get [rutaRemota] [rutaLocal] Copies a remote resource on a local
lmkdir [rutaLocal] Create a folder on your local computer
Print lpwd the local path in which we
working
mkdir [rutaRemota] Create a folder on the remote computer
put [rutaLocal] [rutaRemota] Upload a file or file from a local path
to a remote path
pwd Prints the remote path in which we
working
We left exit SFTP
rename [rutaLocal] [rutaRemota] Renames a remote file
rmdir [rutaRemota] Deletes a remote folder
rm [rutaRemota] Deletes a remote file

Source: http://www.taringa.net/posts/linux/8950780/Montar-Servidor-FTP-en-Linux-_Ubuntu_.html