|
【類別】:網路資源 |
架設 FTP Server(三) |
設定 wu-ftpd Server: 首先您要知道匿名使用者登錄 FTP 時,預設的根目錄位置為 /var/ftp 或 /home/ftp,視您版本而定。 wu-ftpd 的主要設定檔為 /etc/ftpaccess,其它還有像 /etc/ftpusers、/etc/ftphosts,我們底下會分別作說明: /etc/ftpaccess: [root@redhat root]# vi /etc/ftpaccess # Dont allow system accounts to log in over ftp deny-uid %-99 %65534- deny-gid %-99 %65534- 設定拒絕登入 ftp 站台的 uid 及 gid ; 記得,若您以 id 來表示的話,前面要加個 %,以上面為例就是拒絕 0-99 及 65534 以上的 uid 及 gid 登入。若您要拒絕的是 1-500 的 uid 登入,那就寫成 "deny-uid %1-500" 就行了。您也可以針對使用者名稱來做設定,比如 "deny-uid barry mary",這樣 barry 及 mary 就無法登入了。 allow-uid ftp allow-gid ftp 由於 ftp 的 uid 及 gid 大都在 100 以下,這樣會被包含在 deny-uid 及 deny-gid 的範圍內,所以這裡用 allow-uid 及 allow-gid 來允許匿名使用者使用 ftp 的帳號匿名登入。 # Chroot all users to their home directory by default # (comment this out if you dont want to chroot most of your users) guestuser * 如果以真實帳號登入 ftp,預設登錄的根目錄位置就是它們自己的家目錄,而且只能在自己家目錄內活動,無法切換到其它目錄。若將這個設定註解起來,那麼所有使用者就可以切換到其他的目錄。假使您想要 barry 及 mary 登入時只能在自己家目錄內活動,其它用真實帳號登入者可以切換到其他目錄,那麼您可這樣設定: "guestuser barry mary" ; 另外您可使用 guest-root 來限定訪客登入的根目錄位置,比如 "guest-root /tmp/guestdir",這樣訪客登入 ftp 的根目錄就不再是自己的家目錄,而是 /tmp/guestdir。 匿名使用者及訪客都只能在預設的根目錄下活動。 # If you wish to allow user1 and user2 to access other # directories, use the line below: # realuser user1,user2 由於系統預設所有真實帳號登入的使用者只能在自己家目錄內活動,若您想允許少數使用者可以存取其它的目錄,那麼就用 realuser 就行了,比如您將上面 realuser 那一行的註解拿掉,就表示 user1 及 user2 登入 ftp 後可以存取其它的目錄。 # The ftpchroot group doesnt exist by default, this entry is just supplied as an example. # To chroot a user, modify the line below or create the ftpchroot group and add the user to it. # You will need to setup the required applications and libraries in the root directory (set using guest-root). # Look at the anonftp package for the files youll need. guestgroup ftpchroot 這裡是用 guestgroup 來設定訪客群組 ftpchroot,這個群組名稱預設不存在,可用 groupadd 自行建立起來。 若您將使用者加入 ftpchroot 群組中,那麼當這些使用者登入 ftp 後就會被視為訪客,當然您也可使用 guest-root 來限定其登入的根目錄位置。 # User classes... class all real,guest,anonymous * class : 使用者類別。 all : 類別名稱,可自訂,系統這裡設定為 all。 real,guest,anonymous : real 為 server 上具有真實帳號的使用者 ; guest 為訪客 ; anonymous 為匿名使用者。 最後面那個 " * " 表示允許所有來源端連線。若覺如此定義過於寬鬆,可作進一步限制,例如將此欄位原本的 " * " 改成 "*.domain.com.tw" ,這樣就只接受來源端為 domain.com.tw 網域的主機連線。 若改成 192.168.1.* ,那表示只接受 192.168.1.x 的主機。您也可以將以上兩者合併著寫: class all real,guest,anonymous 192.168.1.* *.domain.com.tw 另外也可不改變原設定,而在底下補上 deny 的敘述,例如: class all real,guest,anonymous * deny *.domain.com.tw deny 192.168.1.* 以上寫法需注意的是 deny 要分兩行寫,不能像前面一樣合併起來寫。 |
|
[推薦評價好店]- 4C快修連鎖門市 專業維修買賣 - 筆電 + 手機 + 電腦 + Iphone + Ipad 新北汐止店 (02) 7751-9182 新北市汐止區福德一路86巷22號 汐止修手機.汐止修iphone.汐止修ipad.汐止修筆電.汐止修電腦 新北板橋店 (02) 8257-3990 新北市板橋區四維路137巷10號 板橋修手機.板橋修iphone.板橋修ipad.板橋修筆電.板橋修電腦 桃園大溪店 (03) 387-4353 桃園市大溪區中華路210號 大溪修手機.大溪修iphone.大溪修ipad.大溪修筆電.大溪修電腦 台中市區店 (04) 2201-1289 台中市南區台中路140號 台中修手機.台中修iphone.台中修ipad.台中修筆電.台中修電腦 |