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服務,否則無法生效!