Q:ftp服务器无法用本地用户登录
[test@client home]$ ftp 192.168.221.129
Connected to 192.168.221.129 (192.168.221.129).
220 (vsFTPd 2.2.2)
Name (192.168.221.129:test): test
331 Please specify the password.
Password:
500 OOPS: cannot change directory:/home/test
Login failed.
//但是lftp可以用本地用户登录
A:
- 是否是vsftp服务器端家目录权限问题?
[root@review1 home]# chmod +r test
[root@review1 home]# ls
test
[root@review1 home]# ll
total 4
drwxr--r--. 2 test test 4096 May 27 10:57 test
再次登录,无效。
2.检查本地用户test是否存在,是否有密码
[root@review1 ~]# tail -5 /etc/passwd
saslauth:x:499:76:"Saslauthd user":/var/empty/saslauth:/sbin/nologin
postfix:x:89:89::/var/spool/postfix:/sbin/nologin
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
ntp:x:38:38::/etc/ntp:/sbin/nologin
test:x:500:500::/home/test:/bin/bash
[root@review1 ~]# passwd test
Changing password for user test.
New password:
BAD PASSWORD: it is too simplistic/systematic
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.
存在,密码正常。
3.检查客户端本地用户是否存在
[root@client ~]# tail -5 /etc/passwd
postfix:x:89:89::/var/spool/postfix:/sbin/nologin
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
test:x:500:500::/home/test:/bin/bash
[root@client ~]# passwd test
Changing password for user test.
New password:
BAD PASSWORD: it is too simplistic/systematic
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.
存在,设置正常。再次登录,登录失败!
4.检查、关闭selinux,重新连接,失败。
5. 重启vsftp,再次测试,成功。
[root@mysql ~]# ftp 192.168.221.129
Connected to 192.168.221.129 (192.168.221.129).
220 (vsFTPd 2.2.2)
Name (192.168.221.129:root): test
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
总结:
用户无法进入家目录,是 因为 SElinux限制了本地ftp用户的访问,需要关闭SELinux,但是关闭后还需要重新启动vsftp服务,否则无法生效!