Home > CentOS > Install FTP Server

Install vsftpd
yum install vsftpd

Automatic Turn on ftp server on reboot
chkconfig vsftpd on

Start ftp server
service vsftpd start

Change Default Directory
vim /etc/vsftpd/vsftpd.conf

local_root=/directory

Only allow specific users to login
vim /etc/vsftpd/vsftpd.conf

userlist_enable=YES
userlist_deny=NO
userlist_file=/etc/vsftpd/user_list

vim /etc/vsftpd/user_list

user1
user2
...

Create a custom config for a specific user
vim /etc/vsftpd/vsftpd.conf

user_config_dir=/etc/vsftpd/userconfig

vim /etc/vsftpd/userconfig/username

local_root=/var/www/vhosts/my-helper/htdocs/upload

Enable sftp
openssl req -x509 -nodes -days 365 -newkey rsa:1024 \
-keyout /etc/vsftpd/vsftpd.pem \
-out /etc/vsftpd/vsftpd.pem
vim /etc/vsftpd/vsftpd.conf
Add the following lines

ssl_enable=YES
allow_anon_ssl=NO
force_local_data_ssl=YES
force_local_logins_ssl=YES
ssl_tlsv1=YES
ssl_sslv2=NO
ssl_sslv3=NO
rsa_cert_file=/etc/vsftpd/vsftpd.pem
force_local_logins_ssl=YES

Enable chroot
vim /etc/vsftpd/vsftpd.conf

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

vim /etc/vsftpd/chroot_list (exclude list)

user1
user2
...

Change port
vim /etc/vsftpd/vsftpd.conf

listen_port=8121
ftp_data_port=8120
pasv_min_port=8000
pasv_max_port=8100

vim /etc/sysconfig/iptables

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8121 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8120 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp --dport 8000:8100 -j ACCEPT

reference:
http://wiki.vpslink.com/Configuring_vsftpd_for_secure_connections_%28TLS/SSL/SFTP%29
http://howto.gumph.org/content/setup-virtual-users-and-directories-in-vsftpd/



Flag Counter