How to Install & Configure FTP with users on Centos 7

configure ftp server on centos
How to configure ftp server in redhat 7

The File Transfer Protocol (FTP) is a standard network protocol used to transfer computer files from one host to another host over a TCP-based network, such as the Internet. FTP is built on a client-server architecture and uses separate control and data connections between the client and the server.

FTP is most commonly used to download a file from a server using the Internet or to upload a file to a server (e.g., uploading a Web page file to a server).

Installation of FTP

The first step is to install the vsftpd package on our centos/Redhat machine. Run the following command to install ftp server:

yum install vsftpd -y

Read Also: How to install postgresql on centos?

Adding users

After installing vsftpd package now add users for ftp

Firstly make a home directory for ftp users

mkdir /home/ftphome

Then, add user with no login shell
useradd -b /home/ftphome chetan
passwd chetan
usermod -d /home/ftphome/chetan

Read Also: How to add user on centos?

Modify Configuration file

Now modify the ftp configuration file i.e. vsftpd.conf:

vim /etc/vsftpd/vsftpd.conf

Then do the following Corrections:
anonymous_enable=NO

=> Uncomment

chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list

Then Create a file and add usersname in this file:

vim /etc/vsftpd/chroot_list

Now its a time to change permission on the home directories

chown -R chetan.root /home/ftpusers/chetan
chmod -R 770 /home/ftpusers/chetan

Now manage the selinux policy

setsebool ftp_home_directory on

Restart FTP service

In Centos/Redhat 7 :

systemctl resart vsftpd

systemctl enable vsftpd

In Centos/Redhat 6:

service vsftpd restart

chkconfig vsftpd on

Firewall setting

Now the port 21 or ftp service in firewall rules

in centos7/Redhat7

firewall-cmd --permanent --add-port=21/tcp

firewall-cmd --permanent --add-service=ftp

in centos6/Redhat6

iptables -A INPUT -p tcp -m tcp --dport 21 -j ACCEPT

Testing time

Now go to browser in your machine type

ftp://localhost

or

ftp://yourip

Enter your username and passwd and then you will get access to your ftp.

You can also use software like filezilla to browse ftp..

If you got any problem please free to comment.

Read Also: How to install bucardo for postgres replication

Leave a Reply

Your email address will not be published.


*