[ 永遠的UNIX::UNIX技術資料的寶庫 ]   GB | BIG5

首頁 > 系統管理 > HP-UX > 正文
在HP-UX下建立只歸屬某個目錄下的ftp賬戶
本文出自:http://www.yesky.com 作者: xli14 (2002-04-08 08:02:00)
如何建立一個只歸屬某個目錄下的ftp賬戶?如ftptest通過ftp登陸到系統時,
系統認為/home/ftptest就是他的根(/)。

以下方法在hpux11下測試通過,如在hpux下實現此功能,需要安裝wu_ftp這個軟
件,或者更新你的ftp。

假設要在系統中建立一個ftptest(屬ftptest組),要想在它ftp的時候始終在
/home/ftptest目錄以及它的子目錄下。下面是他的建立步驟。

1。在/etc/passwd中建立相應的ftptest條目,注意他的主目錄的寫法:
ftptest:Aci$xi:555:555:ftp user for chroot:/home/ftptest/./:/bin/ksh
(確信/etc/shells中有/bin/ksh,否則請加上,密碼由你自己決定 )
2。在/etc/passwd中建立相應的組ftptest
ftptest::555:ftptest
3。建立/home/ftptest以及相應的目錄(主要是~ftp/usr/bin和~/ftp/etc)
#mkdir /home/ftptest
#chown ftptest:ftptest /home/ftptest
#su - ftptest
$pwd //make sure it is under /home/ftptest
$mkdir -p usr/bin
$cp /sbin/ls usr/bin ; cp /bin/pwd usr/bin
$mkdir etc
$cp /etc/passwd etc ; cp /etc/group etc (為了安全,你需要修改passwd中
不必要的項,如root)
4。編輯/etc/inetd.conf
確信ftp的那一行是這樣寫的:
ftp stream tcp nowait root /usr/lbin/ftpd ftp -l -a (一定要加上 -a 這
個參數)
5。重新初始化inetd : 執行: inetd -c
6。產生相應的ftpaccess/ftpgroups文件
#cd /etc/ftpd
#touch ftpgroups
#vi ftpaccess //這個文件的內容大致如下:

-=-=-=-=-= Cut Here =-=-=-=-=-
class all real,guest,anonymous *

# Define the line that limits the ftponly group to their own directories

# in the ftp-root heirarchy.
guestgroup ftptest //這裡要和你的組ftptest一致。

email xmli@szdhd.sz.lucent.com //這裡用你自己的email地址

loginfails 5

readme README* login
readme README* cwd=*

message /welcome.msg login
message .message cwd=*

compress yes all
tar yes all
chmod no guest,anonymous
delete no guest,anonymous
overwrite no guest,anonymous
rename no guest,anonymous

log transfers anonymous,real inbound,outbound

shutdown /etc/shutmsg

passwd-check rfc822 warn

-=-=-=-=-= Cut Here =-=-=-=-=-

7。好了,okay了,你可以測試是否正確,我已在hpux11下通過(B2000)。
(http://www.fanqiang.com)
    進入【UNIX論壇

相關文章
ProFTPD 詳解 (2002-04-03 09:26:24)
Java源碼:實現簡單的FTP功能 (2002-01-03 08:10:00)
如何以Solaris架設FTP虛擬系統 (2001-11-01 08:00:01)
ProFtpd快速指南 (2001-10-20 09:05:00)
solaris下匿名FTP安裝 (2001-10-02 10:00:00)
遠程連接(telnet/ftp/rsh/ssh)作為root的用法和總結 (2001-09-02 13:05:00)
如何使用wu-ftp 2.x(site exec bug)來取得root權限 (2001-07-15 07:05:00)
proFTP中如何將用戶限制在自己的home目錄下? (2001-07-09 22:09:22)
如何配置WU-FTP服務器 (2001-06-27 08:10:01)
wu-ftpd使用基礎 (2001-06-27 07:00:00)

===更多相關===
 

★  樊強制作 歡迎分享  ★