May 2024
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  

Categories

May 2024
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  

Setup FTP server on centos 7

yum -y install vsftpd

After installation you can find /etc/vsftpd/vsftpd.conf file which is the main configuration file for VSFTP.
Take a backup copy before making changes .

cp /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd.conf.org

vi /etc/vsftpd/vsftpd.conf

Find this line anonymous_enable=YES ( Line no : 12 ) and change value to NO to disable anonymous FTP access.

anonymous_enable=NO

Uncomment the below line ( Line no : 100 ) to restrict users to their home directory.
chroot_local_user=YES

and add the below lines at the end of the file to enable passive mode and allow chroot writable.
allow_writeable_chroot=YES
pasv_enable=Yes
pasv_min_port=40000
pasv_max_port=40100

Now restart vsftpd service and make it start automatically after reboot.

systemctl restart vsftpd.service

systemctl enable vsftpd.service

Add FTP service in firewall to allow ftp ports .

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

Setup SEinux to allow ftp access to the users home directories
setsebool -P ftp_home_dir on

Now create an User for ftp access. Here /sbin/nologin shell is used to prevent shell access to the server .

useradd -m mohan -s /sbin/nologin
passwd mohan

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>