先添加個本地賬戶,作為虛擬賬號的映射,以下是賬號的基本信息 # finger virtual Login: virtual Name: (null) Directory: /home/ftpsite Shell: /sbin/nologin Never logged in. No mail. No Plan.
配置mysql,建立一個名為vsftpd的資料庫,含一個名為users的用戶名,以下是我以virtual賬號登錄進行測試的過程 # mysql -u virtual -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 111 Server version: 5.0.77 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> use vsftpd; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A
Database changed mysql> select * from users -> select * from users; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select * from users' at line 2 mysql> Aborted # mysql -u virtual -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 112 Server version: 5.0.77 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> use vsftpd; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A
Database changed mysql> select * from users; +----+-------+--------+ | id | name | passwd | +----+-------+--------+ | 1 | tom | foo | | 2 | jerry | bar | +----+-------+--------+ 2 rows in set (0.00 sec) 由此可見此賬號可以順利訪問資料庫了
然後開始測試,詭異的事情發生了,過程如下: # ftp 192.168.1.100 Connected to 192.168.1.100. 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.1.100:root): tom 331 Please specify the password. Password: 230 Login successful. 421 Service not available, remote server has closed connection 明明表示成功登錄了,咋又421了呢?於開始苦逼的百度,甚至看了下老外的論壇,有說可能是家目錄的許可權的問題,於我是這樣 # ls -all drwxr-xr-x 4 virtual virtual 4096 03-21 22:11 ftpsite
其間又測試了下 # ftp 127.0.0.1 Connected to 127.0.0.1. 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 (127.0.0.1:root): tom 331 Please specify the password. Password: 230 Login successful. Remote system type is UNIX. Using binary mode to transfer files. ftp> pwd 421 Service not available, remote server has closed connection