系統管理
1752812 會員
5915 線上
108789 解決方案
發表新文章

FTP Server 權限如何設定?

 
watermelonyu
教授

FTP Server 權限如何設定?

請問在HP 11.11 FTP server權限該如何設定?

1. 使用者設定?可使用?不可使用?

2. 只能限定在某個路徑?



感謝!
14則回覆 14
watermelonyu
教授
watermelonyu
教授

FTP Server 權限如何設定?

When a user attempts to log into your system using ftp, the ftpd daemon checks the /etc/ftpusers file. If the file exists, and the user's login name is listed in it, ftpd denies access to the user.



User accounts that specify a restricted login shell in /etc/passwd should be listed in /etc/ftpusers, because ftpd accesses local accounts without using their login shells. UUCP accounts should also be listed in /etc/ftpusers.



You can use either a text editor or SAM to create and edit the /etc/ftpusers file. SAM (System Administration Manager) is Hewlett-Packard's windows-based user interface for performing system administration tasks. To run SAM, type sam at the HP-UX prompt. SAM has an extensive online help facility.



Each line in /etc/ftpusers consists of a login name with no white space. Following is an example /etc/ftpusers file:



uucp



guest



nobody



For more information, type man 4 ftpusers at the HP-UX prompt.



watermelonyu
教授

FTP Server 權限如何設定?

那有沒有辦法限制user access的路徑呢?還是一定得從路徑的存取權限設定?
watermelonyu
教授

FTP Server 權限如何設定?

1. 使用者設定?可使用?不可使用?

A: 把username放到/etc/ftpd/ftpusers檔案內, 只要使用者名稱存在這個檔案, 則該使用者就無法透過ftp方式登入到本機. 其他沒有在檔案內的username則可以使用



watermelonyu
教授

FTP Server 權限如何設定?

2. 只能限定在某個路徑?

A: a. 首先要確定FTPD的patch level是在PHNE_14479的版本以上, 就可以啟動WU-ftp

root@test > swlist -l product | grep ftpd

PHNE_23950 1.0 ftpd(1M) patch



b. 比方說有一使用者snoopy, 所屬group "external", 要能ftp, 但只能限定在/rawcdr



建立/etc/ftpd/ftpaccess檔案, 內容如下.

---------------------------------------------

class all real,guest,anonymous *

guestgroup external

upload /rawcdr * yes snoopy external 0600 dirs

---------------------------------------------

注意, group "external"需在/etc/group有這筆資料



接下來修改/etc/inetd.conf ftp字串為

ftp stream tcp nowait root /usr/lbin/ftpd ftpd -l -a



以inetd -c 重起inetd



則當snoopy登入時, 只能在/rawcdr路徑下, 無法chdir到/rawcdr外的其他路徑, 如在/rawcdr下建立檔案或目錄, 則檔案, 目錄所屬user, group分別為snoopy, external, umask為0600, dirs表示可以建立目錄, 如不允許建立目錄, 則dirs應該為nodirs
watermelonyu
教授

FTP Server 權限如何設定?

追加一個小問題,我想要disable所有User不能delete任何檔案的功能。在 ftpaccess需怎麼設定?



我設定了以下,必且重啟了inetd -c (沒有修改inetd.conf) 這樣是不是不行?



delete no guest,anonymous,nini # delete permission?

watermelonyu
教授

FTP Server 權限如何設定?

在inetd.conf檔案中的ftp設定, 一定要有-a參數, ftpd才會去讀/etc/ftpd/ftpaccess的設定.



此外, 如果依照上面的範例, 要讓snoopy無法刪除檔案, 則需在/etc/ftpd/ftpaccess中新增以下

---------------------------------------------

delete no external,guest,anonymous

---------------------------------------------



當snoopy嘗試將上傳的檔案刪除時, 系統就會回應.

---------------------------------------------

ftp> del snoopy.xls

553 snoopy.xls: Permission denied. (Delete)

ftp>

---------------------------------------------



watermelonyu
教授

FTP Server 權限如何設定?

HP-UX 提供一個很有用的 sample ftpaccess file... /usr/newconfig/etc/ftpd/examples/ftpaccess, 你可以從中找到你想限制的特別權限, 例如



----

# all the following default to "yes" for everybody

delete no guest,anonymous # delete permission?

overwrite no guest,anonymous # overwrite permission?

rename no guest,anonymous # rename permission?

chmod no anonymous # chmod permission?

umask no anonymous # umask permission?

watermelonyu
教授

FTP Server 權限如何設定?

以下是我ftpaccess的設定。使用一個屬於dba group的user進行測試。

想達到的功能是,不能讓他delete,並且限制特定user只能access特定目錄。



我做了以下設定後,發現確實不能delete資料,但是user login之後,就只能限制在$HOME路徑下,無法跳至其他路徑。

儘管他在其他File system,例如/test下有存取權限,但就是無法cd /test。不曉得哪裡漏掉了?請指教!





loginfails 2

class local real,guest,anonymous *.domain 0.0.0.0

class remote real,guest,anonymous *

readme README* login

readme README* cwd=*

message /welcome.msg login

message .message cwd=*

compress yes local remote

tar yes local remote

private yes

delete no dba,sys,root,guest,anonymous # delete permission?

overwrite no guest,anonymous # overwrite permission?

rename no guest,anonymous # rename permission?

chmod no anonymous # chmod permission?

umask no anonymous # umask permission?

guestgroup dba