- # ftp 127.0.0.1
- Connected to 127.0.0.1 (127.0.0.1).
- 220 Welcom to my FTP server.
- Name (127.0.0.1:root): gou
- 331 Please specify the password.
- Password:
- 230 Login successful. Have fun.
- Remote system type is UNIX.
- Using binary mode to transfer files.
測試下載服務(wù)器目錄中的一個(gè)文件mytest:
- ftp> get mytest
- local: mytest remote: mytest
- 227 Entering Passive Mode (127,0,0,1,159,19)
- 150 Opening BINARY mode data connection for mytest (21 bytes).
- 226 File send OK.
- 21 bytes received in 0.00038 secs (54 Kbytes/sec)
測試上傳本機(jī)目錄中的文件vsftpd.conf:
- ftp> !ls
- account.db chroot_list k mytest userconf vsftpd.conf
- ftp> put vsftpd.conf
- local: vsftpd.conf remote: vsftpd.conf
- 227 Entering Passive Mode (127,0,0,1,117,203)
- 150 Ok to send data.
- 226 File receive OK.
- 4229 bytes sent in 0.00195 secs (2.1e+03 Kbytes/sec)
可以看到,使用沒有系統(tǒng)賬號的虛擬用戶可以成功完成上傳、下載的工作。但該FTP虛擬服務(wù)器只允許虛擬用戶登錄,其它系統(tǒng)用戶無法登錄,如系統(tǒng)用戶user1不是虛擬用戶,則不能登錄該虛擬服務(wù)器。
- # ftp 127.0.0.1
- Connected to 127.0.0.1 (127.0.0.1).
- 220 Welcom to my FTP server.
- Name (127.0.0.1:root): user1
- 331 Please specify the password.
- Password:
- 530 Login incorrect.
- Login failed.
在虛擬FTP服務(wù)器中,也可以對各個(gè)用戶的權(quán)限進(jìn)行設(shè)置。方法是在/etc/vsftpd.conf文件中添加如下一行:
- user_config_dir=用戶配置文件目錄
然后在用戶配置文件目錄下創(chuàng)建相應(yīng)的用戶配置文件,比如為上述名為gou的用戶創(chuàng)建一個(gè)配置文件(假設(shè)配置文件目錄為/etc/user_config_dir):
- #vi /etc/user_config_dir/gou
- write_enable=NO
- anono_upload_enable=NO
重啟FTP服務(wù)器,這時(shí)再使用賬號gou來登錄,就已經(jīng)沒有上傳的權(quán)限了。