November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

Categories

November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

VSFTP CENTOS 7

mkdir -p /ftpserver/open
mkdir -p /ftpserver/private

yum -y install ftp vsftpd

[root@keeplive ~]# rpm -qf /usr/bin/db_load
libdb-utils-5.3.21-17.el7_0.1.x86_64

echo opentest > /ftpserver/open/open.txt

echo ftptest > /tmp/ftptest1.txt

touch /ftpserver/open/webapp.txt

[root@keeplive ~]# rpm -qc vsftpd
/etc/logrotate.d/vsftpd
/etc/pam.d/vsftpd
/etc/vsftpd/ftpusers
/etc/vsftpd/user_list
/etc/vsftpd/vsftpd.conf
[root@keeplive ~]#

vi /etc/vsftpd/vftpuser.txt
alice
P@ssw0rd
jack
P@ssw0rd
tom
P@ssw0rd

db_load -T -t hash -f /etc/vsftpd/vftpuser.txt /etc/vsftpd/vftpuser.db

[root@keeplive vsftpd]# file /etc/vsftpd/vftpuser.db
/etc/vsftpd/vftpuser.db: Berkeley DB (Hash, version 9, native byte-order)
[root@keeplive vsftpd]#

useradd -d /ftpserver/private -s /sbin/nologin ftpuser1

root@keeplive vsftpd]# cat /etc/pam.d/vsftpd
#%PAM-1.0
session optional pam_keyinit.so force revoke
auth required pam_listfile.so item=user sense=deny file=/etc/vsftpd/ftpusers onerr=succeed
auth required pam_shells.so
auth include password-auth
account include password-auth
session required pam_loginuid.so
session include password-auth
auth required pam_userdb.so db=/etc/vsftpd/vftpuser
account required pam_userdb.sodb=/etc/vsftpd/vftpuser

vi /etc/vsftpd/vsftpd.conf

anon_root=/ftpserver/open
virtual_use_local_privs=YES
guest_enable=YES
guest_username=vftpuser
chroot_local_user=YES
allow_writeable_chroot=YES

[root@keeplive vsftpd]# systemctl enable vsftpd
ln -s ‘/usr/lib/systemd/system/vsftpd.service’ ‘/etc/systemd/system/multi-user.target.wants/vsftpd.service’

[root@keeplive vsftpd]# systemctl status vsftpd
vsftpd.service – Vsftpd ftp daemon
Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; enabled)
Active: active (running) since Fri 2014-11-14 16:29:23 SGT; 4 days ago
Main PID: 1301 (vsftpd)
CGroup: /system.slice/vsftpd.service
??1301 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf

Nov 14 16:29:23 keeplive systemd[1]: Starting Vsftpd ftp daemon…
Nov 14 16:29:23 keeplive systemd[1]: Started Vsftpd ftp daemon.
Nov 18 21:14:00 keeplive systemd[1]: Started Vsftpd ftp daemon.

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>