ftp虚拟用户实验报告

ftp虚拟用户实验报告

[root@localhost ~]# vim /etc/selinux/config
This file controls the state of SELinux on the system.
#SELINUX= can take one of these three values: enforcing - SELinux security policy is enforced.
permissive - SELinux prints warnings instead of enforcing.
disabled - No SELinux policy is loaded.
SELINUX=disabled
SELINUXTYPE= can take one of three two values:
targeted - Targeted processes are protected,
minimum - Modification of targeted policy. Only selected processes are protected.
mls - Multi Level Security protection.
SELINUXTYPE=targeted
[root@localhost ~]# reboot
[root@localhost ~]# getenforce
Disabled
[root@localhost ~]# yum -y install vsftpd ftp
[root@localhost ~]# cd /etc/vsftpd/
[root@localhost vsftpd]# vim vuser.list
mmm
123
nnn
123
[root@localhost vsftpd]# db_load -T -t hash -f vuser.list vuser.db
root@localhost vsftpd]# file vuser.db
vuser.db: Berkeley DB (Hash, version 9, native byte-order)
[root@localhost vsftpd]# cd /etc/pam.d/
[root@localhost pam.d]# cp vsftpd vsftpd.bak
[root@localhost pam.d]# vim vsftpd
#%PAM-1.0
auth required pam_userdb.so db=/etc/vsftpd/vuser
account required pam_userdb.so db=/etc/vsftpd/vuser
[root@localhost vsftpd]# cd /etc/vsftpd/
[root@localhost vsftpd]# useradd -d /var/ftproot -s /sbin/nologin wzm
[root@localhost vsftpd]# vim vsftpd.conf
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
anon_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
chroot_local_user=YES
allow_writeable_chroot=YES
listen=NO
listen_ipv6=YES
pam_service_name=vsftpd
userlist_enable=YES
guest_enable=YES
guest_username=wzm
user_config_dir=/etc/vsftpd/users
tcp_wrappers=YES
[root@localhost vsftpd]# mkdir users
[root@localhost vsftpd]# cd users/
[root@localhost users]# vim mmm
anon_upload_enable=YES
anon_mkdir_write_enable=YES
[root@localhost users]# touch nnn
[root@localhost users]# chmod 777 /var/ftproot/
[root@localhost users]# systemctl stop firewalld
[root@localhost users]# systemctl restart vsftpd

[root@localhost ~]# touch {1…10}.txt
[root@localhost ~]# cd /var/ftproot/
[root@localhost ftproot]# touch {a…d}.txt
[root@localhost ~]# ftp 192.168.1.100
Connected to 192.168.1.100 (192.168.1.100).
220 (vsFTPd 3.0.2)
Name (192.168.1.100:root): mmm
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
227 Entering Passive Mode (192,168,1,100,151,99).
150 Here comes the directory listing.
-rw-r–r-- 1 0 0 0 Dec 13 10:37 a.txt
-rw-r–r-- 1 0 0 0 Dec 13 10:37 b.txt
-rw-r–r-- 1 0 0 0 Dec 13 10:37 c.txt
-rw-r–r-- 1 0 0 0 Dec 13 10:37 d.txt
226 Directory send OK.
ftp> put 1.txt
local: 1.txt remote: 1.txt
227 Entering Passive Mode (192,168,1,100,135,120).
150 Ok to send data.
226 Transfer complete.
ftp> ls
227 Entering Passive Mode (192,168,1,100,137,82).
150 Here comes the directory listing.
-rw-r–r-- 1 1001 1001 0 Dec 13 10:41 1.txt
-rw-r–r-- 1 0 0 0 Dec 13 10:37 a.txt
-rw-r–r-- 1 0 0 0 Dec 13 10:37 b.txt
-rw-r–r-- 1 0 0 0 Dec 13 10:37 c.txt
-rw-r–r-- 1 0 0 0 Dec 13 10:37 d.txt
226 Directory send OK.
ftp> get a.txt
local: a.txt remote: a.txt
227 Entering Passive Mode (192,168,1,100,32,209).
150 Opening BINARY mode data connection for a.txt (0 bytes).
226 Transfer complete.
[root@localhost ~]# ftp 192.168.1.100
Connected to 192.168.1.100 (192.168.1.100).
220 (vsFTPd 3.0.2)
Name (192.168.1.100:root): nnn
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
227 Entering Passive Mode (192,168,1,100,180,116).
150 Here comes the directory listing.
-rw-r–r-- 1 1001 1001 0 Dec 13 10:41 1.txt
-rw-r–r-- 1 0 0 0 Dec 13 10:37 a.txt
-rw-r–r-- 1 0 0 0 Dec 13 10:37 b.txt
-rw-r–r-- 1 0 0 0 Dec 13 10:37 c.txt
-rw-r–r-- 1 0 0 0 Dec 13 10:37 d.txt
226 Directory send OK.
ftp> get b.txt
local: b.txt remote: b.txt
227 Entering Passive Mode (192,168,1,100,236,56).
150 Opening BINARY mode data connection for b.txt (0 bytes).
226 Transfer complete.
ftp> put 2.txt
local: 2.txt remote: 2.txt
227 Entering Passive Mode (192,168,1,100,179,194).
550 Permission denied.
ftp> ls
227 Entering Passive Mode (192,168,1,100,60,202).
150 Here comes the directory listing.
-rw-r–r-- 1 1001 1001 0 Dec 13 10:41 1.txt
-rw-r–r-- 1 0 0 0 Dec 13 10:37 a.txt
-rw-r–r-- 1 0 0 0 Dec 13 10:37 b.txt
-rw-r–r-- 1 0 0 0 Dec 13 10:37 c.txt
-rw-r–r-- 1 0 0 0 Dec 13 10:37 d.txt
226 Directory send OK.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值