天天看點

proftpd虛拟使用者配置跨目錄通路

建立虛拟使用者。

1. 在/etc/proftpd.conf中加入

RequireValidShell off

AuthOrder mod_auth_file.c

AuthUserFile /usr/local/etc/proftpd/passwd

AuthGroupFile /usr/local/etc/proftpd/group

其中,AuthOrder指定了權限檢查的順序。這裡隻使用虛拟使用者。AuthUserFile和AuthGroupFile的檔案格式看passwd(5)和group(5)。如果使用者名群組名與系統的重複,看DirFakeUser和DirFakeGroup。

2. 使用ftpasswd建立passwd和group檔案

$ ftpasswd --passwd --file=/usr/local/etc/proftpd/passwd --name=test1 --uid=2001 --home=/home/nohome --shell=/bin/false

$ ftpasswd --passwd --file=/usr/local/etc/proftpd/passwd --name=test2 --uid=2002 --home=/home/nohome --shell=/bin/false

建立了一個test1和test2使用者

$ ftpasswd --group --name=test --gid=2001

建立了一個test組

$ ftpasswd --group --name=test --gid=2001 --member=test1 --member=test2

把test1和test2加入test組

3. 重新開機proftpd 

備注:

ftpasswd指令在proftpd的源代碼包裡就有,比如我的就在:

/usr/src/proftpd-1.3.1/contrib/ftpasswd

把ftpasswd改為可執行,拷貝到你可以用的任意地方就行了。

------------------------------------------------------------------------------------------》

1.讓proftpd 支援虛拟使用者這個子產品。2.使用ftpasswd建立使用者

ftpasswd --passwd --file=/usr/localproftpd/etc/passwd --name=test1 --uid=2001 --home=/test --shell=/sbin/nologin

ftpasswd --passwd --file=/usr/local/proftpd/etc/passwd --name=test2 --uid=2002 --home=/test --shell=/sbin/nologin

這兩個使用者同時都指向同一個目錄/test,授予權限 chmod -R  777  /test     .并且這個兩個使用者同時都可以上傳下載下傳。

3.如果兩個使用者權限不一樣的,test1 具有讀寫權限, test2具有讀權限。

ftpasswd --passwd --file=/usr/localproftpd/etc/passwd --name=test2 --uid=2002 --home=/test --shell=/sbin/nologin

chmod -R  755 /test

這個時候 test1具有讀寫權限,test2具有讀權限

4.删除使用者可以直接到 /usr/localproftpd/etc/passwd   找到自己要删除的一行就可以

備注:ftpasswd 建立的使用者uid可以重複,如果建立test3使用者的UID=2001 ,這個時候test1和test3具有相同權限。

本文轉自 liang3391 51CTO部落格,原文連結:vhttp://blog.51cto.com/liang3391/538056