Redhat上ftp的配置總結及常見問題

(1) Install vsftpd, if installed, ignore.
=> # yum install vsftpd

(2) Start vsftpd
=> # service vsftpd start
=> # chkconfig --level 35 vsftpd on // If start vsftpd when os starts, run command, 解析: chkconfig --level 35 vsftpd on : 設定vsftpd在等級3和5爲開機運行服務,--level 35表示操作只在等級3和5執行,on表示啓動,off表示關閉

(3) 主要目錄及配置文件
=> (1) /etc/vsftpd/ => config, user_list, ftpusers, chroot_list and so on.
vsftpd.ftpusers:位於/etc目錄下。它指定了哪些用戶賬戶不能訪問FTP服務器,例如root等。
vsftpd.user_list:位於/etc目錄下。該文件裏的用戶賬戶在默認情況下也不能訪問FTP服務器,僅 當vsftpd .conf配置文件裏啓用userlist_enable=NO選項時才允許訪問。
vsftpd.conf:位於/etc/vsftpd目錄下。來自定義用戶登錄控制、用戶權限控制、超時設置、服務器功能選項、服務器性能選項、服務器響應消息等FTP服務器的配置。
主要的配置:
anonymous_enable=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list
=> (2) /etc/pam.d/vsftpd => pam secure issue.
這個涉及到權限問題,有時需要屏蔽掉
#auth required pam_shells.so

(4) 設置用戶
=> # useradd -d /home/user user // 創建用戶並設定目錄
# passwd user // 設置密碼
# usermod -s /sbin/nologin user //不能用shelll登陸

=> userdel user // 刪除用戶

(5) 設置訪問權限
=> 如果想用戶擁有訪問別的目錄的權限,需要打開chroot_list_enable=YES和chroot_list_file=/etc/vsftpd.chroot_list並把用戶名放到裏面。

(6) 常見登陸拒絕問題。
=> 若被拒絕登陸,刪除/etc/vsftpd/user_list裏面對應的用戶名。
=> 550 Create directory operation failed
# vi /etc/selinux/config
    # This file controls the state of SELinux on the system.
        # SELINUX= can take one of these three values:
        #     enforcing - SELinux security policy is enforced.
        #     permissive - SELinux prints warnings instead of enforcing.
        #     disabled - No SELinux policy is loaded.
        SELINUX=enforcing           (把默認的改成disabled
        # SELINUXTYPE= can take one of these two values:
        #     targeted - Targeted processes are protected,
        #     mls - Multi Level Security protection.
        SELINUXTYPE=targeted
    然後重啓就ok了。

(7) 爲了方便,在用戶目錄下可以建 .netrc 文件
在當前用戶的主目錄創建一個.netrc文件,權限設置600
文件內容是:
machine 192.168.0.1
 login ftpuser 
password ftpuser_password

後面每次登陸時就不用再輸入密碼了
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章