Centos – How to create an FTP user with access to the CentOS Virtual Server

centosftp

I have a virtual server running CentOS, and need to create an FTP user to give to a client so they can upload some files to me.

Any idea how I go about this, and how I only give them access to upload from one folder? (I don't care what folder, as long as they do not get access to my other files.)

Thanks.

Best Answer

Here are the basics

Create a local user account for your client give it a password and home directory etc.

Install vsftpd

yum install vsftpd

Edit

/etc/vsftpd/vsftpd.conf

anonymous_enable=NO
local_enable=YES
write_enable=YES
xferlog_file=YES
local_umask=022
chroot_local_user=YES
listen=YES
pam_service_name=vsftpd

save the file and exit then restart vsftpd

/sbin/service vsftpd restart

and ensure it runs when the system starts

/sbin/chkconfig vsftpd on

Edit /etc/sysconfig/iptables-config

ensure that there is an entry for IPTABLES_MODULES which amongst other things contains ip_conntrack_ftp e.g.

IPTABLES_MODULES="ip_conntrack_ftp"

Then modify the firewall

/sbin/service iptables save

edit /etc/sysconfig/iptables

After the line

:RH-Firewall-1-Input - [0:0] or similar ( the [0:0] may be different) add

-A RH-Firewall-1-INPUT -m state --state NEW -p tcp --dport 21 -j ACCEPT

save the file and exit then restart the firewall

/sbin/service iptables restart

You sould be good to go.

Related Topic