在rhel5下建立ftp服務時遇到本地賬戶無法創建目錄和文件錯誤,解決辦法如下
添加虛擬用戶,也就是不讓用戶登入系統,只能登入FTP的用戶。如果我們想把beinan這個用戶目錄定位在/var/ftp/pub這個目錄中,根據上面的方法。我們應該如下操作
[root@linuxsir001 backupNow]# adduser -d /var/ftp/pub -g ftp -s /sbin/nologin beinan
[root@linuxsir001 backupNow]# passwd beinan
Changing password for user beinan.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[root@linuxsir001 backupNow]#
#在root用戶下執行如下命令
setsebool -P allow_ftpd_anon_write=1
#查看幫助信息
man ftpd_selinux
#創建目錄
mkdir /etc/selinux/POLICYTYPE/contexts/files/
cd /etc/selinux/POLICYTYPE/contexts/files/
vi file_contexts.local
#文件內容如下
/var/ftp/pub(/.*)? system_u:object_r:public_content_rw_t
#執行如下命令
chcon -t public_content_rw_t /var/ftp/pub
#/var/ftp/pub是ftp的主目錄
posted on 2007-05-24 16:44
無聲 閱讀(4813)
評論(0) 編輯 收藏 所屬分類:
職場生活