How to install ftp server and create a FTP user with specific directory access only on a Linux

Install  ftp server :

yum install vsftpd
service vsftpd start
chkconfig vsftpd on

Configure VSFTP:

Take backup of  /etc/vsftpd/vsftpd.conf configuration file in linux server and add these options to your config file.

mv  /etc/vsftpd/vsftpd.conf  /etc/vsftpd/vsftpd.conf.old

vim  /etc/vsftpd/vsftpd.conf

anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
anon_umask=077
anon_upload_enable=YES
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
chown_uploads=YES
chown_username=daemon
xferlog_std_format=YES
listen=YES

pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
chroot_local_user=YES

Restart the vsftpd:

  service vsftpd restart

Create user and specific path and ftp user only connect that path.

Example:

username:ftp_domain

groupname:ftp_domain

path=/home/ftp_domain

Configuration;

[root@a]# groupadd ftp_domain
[root@a]# useradd -g ftp_domain -d /home/ftp_domain -s /sbin/nologin ftp_domain
[root@a]# passwd ftp_domain
Changing password for user ftp_domain.
New password:
BAD PASSWORD: it is too simplistic/systematic
Retype new password:
passwd: all authentication tokens updated successfully.
[root@a]# cat /etc/passwd | grep ftp_domain
ftp_domain:x:5004:5005::/home/ftp_domain:/sbin/nologin
[root@a]# cat /etc/group | grep ftp_domain
ftp_domain:x:5005:
[root@a]#

Test it with filezilla ftp client:

 

fz

[root@a]# ls -l /home/ftp_domain/
total 4
drwxr-xr-x 2 ftp_domain ftp_domain 4096 Dec 15 17:43 images
[root@a]#

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s