本地用户访问FTP服务,拒绝匿名用户访问

配置本地用户访问FTP服务,拒绝匿名用户访问

验证黑白名单

禁锢普通用户在自己的主目录里面


一、查看安装软件包

[root@localhost Server]# rpm -q vsftpd

package vsftpd is not installed

[root@localhost Server]# rpm -ivh vsftpd-2.0.5-28.el5.x86_64.rpm

warning: vsftpd-2.0.5-28.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

Preparing...                ########################################### [100%]

  1:vsftpd                 ########################################### [100%]

[root@localhost ~]# useradd lili

[root@localhost ~]# useradd maka

[root@localhost ~]# useradd kaka

[root@localhost ~]# echo "123456" | passwd --stdin lili

Changing password for user lili.

passwd: all authentication tokens updated successfully.

[root@localhost Server]# useradd kaka

[root@localhost Server]# echo "123456" | passwd --stdin lili

Changing password for user lili.

passwd: all authentication tokens updated successfully.

[root@localhost ~]# echo "123456" | passwd --stdin maka

Changing password for user maka.

passwd: all authentication tokens updated successfully.

[root@localhost ~]# echo "123456" | passwd --stdin kaka

Changing password for user kaka.

passwd: all authentication tokens updated successfully.


二、修改主配置

[root@localhost ~]# vim /etc/vsftpd/vsftpd.conf

...

12 anonymous_enable=NO  (拒绝匿名用户登录)

...

[root@localhost ~]# vim /etc/vsftpd/ftpusers(设置黑名单)

...

lili

[root@localhost ~]# grep lili /etc/vsftpd/ftpusers

lili

[root@localhost ~]#Vim /etc/vsftpd/user_list

...

maka

[root@localhost ~]# grep maka /etc/vsftpd/user_list(设置黑白名单)

maka


[root@localhost ~]# vim /etc/vsftpd/vsftpd.conf

...

119 userlist_deny=NO     (只允许user_list里面的用户访问ftp)

[root@localhost ~]# grep userlist_deny /etc/vsftpd/vsftpd.conf

userlist_deny=NO


三、启动服务

[root@localhost ~]# service vsftpd restart

关闭 vsftpd:                                              [确定]

为 vsftpd 启动 vsftpd:                                    [确定]

[root@localhost ~]# chkconfig vsftpd on


四、客户端测试

root@localhost ~]# ftp 192.168.10.10(只允许user_list里面的用户访问FTP)

Connected to 192.168.10.10.

220 (vsFTPd 2.0.5)

530 Please login with USER and PASS.

530 Please login with USER and PASS.

KERBEROS_V4 rejected as an authentication type

Name (192.168.10.10:root): maka

331 Please specify the password.

Password:

230 Login successful.

Remote system type is UNIX.

Using binary mode to transfer files.

ftp> pwd

257 "/home/maka"


五、将实验环境还

...

12 anonymous_enable=YES(允许匿名用户登录)

...

119 userlist_deny=YES(不允许userlist_deny里的用户登录)


(目前只有kaka能登陆访问,lili用户在黑名单里,maka在黑白名单里设置的不允许访问ftp)




你可能感兴趣的:(用户,软件包,黑白用户访问)