vsftpd 基本配置實踐 匿名anonymous使用者上傳檔案 和 root 登陸

來源:互聯網
上載者:User
 昨天開始就一直在弄vsftp, 只需要測試一下板子的dn和up速度.不需要太多的安全性考慮,兩個問題.匿名和root使用者登入,上傳檔案,在網上找到的東西感覺都很亂而且試了全都失敗..最後終於看到一篇能讓人看明白且好使的..轉過來放著..

vsftpd 基本配置實踐 匿名anonymous使用者上傳檔案 和 root 登陸
可可火山 20080411
http://linux.chinaunix.net/bbs/viewthread.php?tid=989486&extra=&page=1

以下為在CentOS中測試,讓匿名anonymous使用者上傳檔案,一切設定檔從初時狀態開始:
1.file:/etc/vsftpd/vsftpd.conf
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
anon_mkdir_write_enable=YES
2.anonymous登陸後發現還是不能upload,報許可權錯誤,不管在/目錄還是/pub.檢查/pub許可權發現許可權很低.
[root@CentOS5 pub]# ls -ld /var/ftp/pub/
drwxr-xr-x 3 root root 4096 Mar 17 00:07 /var/ftp/pub/
這個時候需要建個目錄來讓使用者上傳.
[root@CentOS5 pub]# mkdir /var/ftp/incomming
[root@CentOS5 pub]# chmod a+w /var/ftp/incomming
3.重新匿名使用者登陸,在/incomming內上傳檔案和建目錄OK.

以下為在CentOS中測試,讓root通過ftp登陸,一切設定檔從初時狀態開始:
1.刪除/etc/vsftpd/user_list中的root一行.
# vsftpd userlist
# If userlist_deny=NO, only allow users in this file
# If userlist_deny=YES (default), never allow users in this file, and
# do not even prompt for a password.
# Note that the default vsftpd pam config also checks /etc/vsftpd/ftpusers
# for users that are denied.
這樣用root登陸,不會直接deny,但輸入正確密碼還是不能登陸.查看/etc/log/secure就可以發現pam阻止了root的登陸.
2.找到/etc/pam.d/vsftpd發現pam會檢查/etc/vsftpd/ftpusers設定檔.
開啟/etc/vsftpd/ftpusers的第一行說明了這個設定檔的作用
# Users that are not allowed to login via ftp
刪除root一行重啟vsftpd後root就可以登陸了.

後話:1.ftp屬於明文傳輸,有安全隱患.更不用說拿root直接登陸ftp.
     2.推薦使用ssh,即可以跑命令也可以傳檔案.

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.