vsftpd有三种访问方式:匿名用户,本地用户和虚拟用户
[root@DBSVR02 ~]# vim /etc/vsftpd/vsftpd.conf
[root@DBSVR02 ~]# vim /etc/vsftpd/ftpusers
[root@DBSVR02 ~]# vim /etc/vsftpd/user_list
======================================
C:\Users\Administrator>ftp 168.168.80.9
连接到 168.168.80.9。
220 (vsFTPd 2.2.2)
用户(168.168.80.9:(none)): root
331 Please specify the password.
密码:
500 OOPS: cannot change directory:/root
500 OOPS: priv_sock_get_cmd
远程主机关闭连接。
C:\Users\Administrator>
=====================================
[root@DBSVR02 home]# useradd -d /home/ftp_usr ftp_usr
=====================================
ftp> user
用户名 ftp_usr
331 Please specify the password.
密码:
500 OOPS: cannot change directory:/home/ftp_usr
500 OOPS: priv_sock_get_cmd
远程主机关闭连接。
ftp>
=====================================
[root@DBSVR02 vsftpd]# userdel ftp_usr
[root@DBSVR02 vsftpd]# ll /home
total 4
drwx------. 2 500 500 4096 May 4 04:05 ftp_usr
[root@DBSVR02 vsftpd]#
=====================================
[root@DBSVR02 vsftpd]# userdel -rf ftp_usr
userdel: user 'ftp_usr' does not exist
[root@DBSVR02 vsftpd]# useradd -d /home/ftp_usr/ ftp_usr
useradd: warning: the home directory already exists.
Not copying any file from skel directory into it.
Creating mailbox file: File exists
[root@DBSVR02 vsftpd]# userdel -rf ftp_usr
[root@DBSVR02 vsftpd]# ll /home/ftp_usr
ls: cannot access /home/ftp_usr: No such file or directory
[root@DBSVR02 vsftpd]#
============================================
原来只能将ftp用户建立在/var/ftp下
[root@DBSVR02 vsftpd]# useradd -d /var/ftp/ftp_usr ftp_usr
[root@DBSVR02 vsftpd]# passwd ftp_usr
Changing password for user ftp_usr.
New password:
BAD PASSWORD: it is based on a dictionary word
Retype new password:
passwd: all authentication tokens updated successfully.
[root@DBSVR02 vsftpd]#
C:\Users\Administrator>ftp 168.168.80.9
连接到 168.168.80.9。
220 (vsFTPd 2.2.2)
用户(168.168.80.9:(none)): ftp_usr
331 Please specify the password.
密码:
230 Login successful.
ftp>
ftp> put test.txt
200 PORT command successful. Consider using PASV.
553 Could not create file.
ftp>
=================================
可以下载,不能上传。
[root@DBSVR02 ftp_usr]# id ftp_usr
uid=500(ftp_usr) gid=500(ftp_usr) groups=500(ftp_usr)
[root@DBSVR02 ftp_usr]#
===============================
[root@DBSVR02 ftp_usr]# usermod -a -G ftp ftp_usr
[root@DBSVR02 ftp_usr]# cat /etc/passwd | grep ftp
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
ftp_usr:x:500:500::/var/ftp/pub/ftp_usr:/bin/bash
[root@DBSVR02 ftp_usr]# usermod -g ftp ftp_usr
[root@DBSVR02 ftp_usr]# cat /etc/passwd | grep ftp
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
ftp_usr:x:500:50::/var/ftp/pub/ftp_usr:/bin/bash
[root@DBSVR02 ftp_usr]# id ftp_usr
uid=500(ftp_usr) gid=50(ftp) groups=50(ftp)
[root@DBSVR02 ftp_usr]#
=============================
搞到最后,原来是SELinux的问题,setenforce 1就可以了: