歡迎您光臨本站 註冊首頁

freebsd下安裝proftpd

←手機掃碼閱讀     火星人 @ 2014-03-04 , reply:0

freebsd下安裝proftpd

# BY kerryhu(聆聽未來)
# BLOG:http://kerry.blog.51cto.com

源碼包安裝:

1. 安裝proftpd1
---------------------------------------------------------------------freebsd# tar zxvf proftpd-1.2.10.tar.gz
freebsd# cd proftpd-1.2.10
freebsd# ./configure --prefix=/usr/local/proftpd
freebsd# make
freebsd# make install2. 創建ftpassswd命令
---------------------------------------------------------------------
從 http://www.castaglia.org/proftpd/contrib/ftpasswd 獲得ftpasswd的perl源代碼,
並保存為 /usr/local/proftpd/sbin/ftpasswd 。freebsd# chmod 755 /usr/local/proftpd/sbin/ftpasswd通過ftpasswd命令,可以對ProFTPD的虛擬用戶進行管理。freebsd# echo "wheel:*:0:" >> /usr/local/proftpd/etc/ftpd.groupfreebsd# /usr/local/proftpd/sbin/ftpasswd --passwd --name=admin --uid=2001 --gid=0 --home=/ftp/admin --shell=/bin/bash --file=/usr/local/proftpd/etc/ftpd.passwd...
Password: <new password>
Re-type password: <new password>freebsd# /usr/local/proftpd/sbin/ftpasswd --passwd --name=kerry --uid=2101 --gid=2000 --home=/ftp/kerry --shell=/usr/sbin/nologin --file=/usr/local/proftpd/etc/ftpd.passwd...
Password: <new password>
Re-type password: <new password>

之後會自動生成/usr/local/proftpd/etc/ftpd.passwdfreebsd# chmod -R 777 /ftp/admin
freebsd# chmod -R 777 /ftp/kerry要注意,因為虛擬用戶並不在本地系統用戶中存在,所以要設置虛擬用戶可以訪問的所有目錄都允許其它用戶寫,這樣

才能保證虛擬用戶正常增刪文件。



3. 修改配置文件

------------------------------------------------------------------------------------freebsd# vi /usr/local/proftpd/etc/proftpd.confServerName "My FTP Server"
ServerType standalone
DefaultServer on

#Bind 10.10.10.10
ExtendedLog /var/log/proftpd read,write,auth
# 原來的設置項是ScoreboardPath,但現在版本的proftpd已不再支持,改用ScoreboardFile
ScoreboardFile /usr/local/proftpd/var/proftpd/proftpd.scoreboard

Port 21
Umask 022

MaxInstances 500
MaxClients 100
# 如果允許匿名訪問或多人共用同一帳號,MaxHostsPerUser和MaxClientsPerUser不應設置過小,或不用設置
MaxHostsPerUser 100 "Sorry, only 1 host allowed per user!"
MaxClientsPerUser 100 "Sorry, only 1 connection allowed per user!"
TimeoutIdle 600
TimeoutStalled 600

# 不顯示伺服器相關信息, 如proftpd版本
ServerIdent off
# 禁用反向域名解析
UseReverseDNS off

# 支持FXP
AllowForeignAddress on
# 支持被動模式
PassivePorts 49152 65534

AllowOverwrite on
# 允許下載續傳,默認即開啟,但為了明確我顯示地聲明
AllowRetrieveRestart on
# 允許上載續傳
AllowStoreRestart on

DisplayLogin welcome.msg
DisplayFirstChdir .message

User nobody
Group nogroup
# 不要求有合法shell,直接效果是允許nologin用戶和虛擬用戶登錄
RequireValidShell off
# 設置用戶驗證順序是先虛擬用戶再本地用戶
AuthOrder mod_auth_file.c mod_auth_unix.c
# 指定虛擬用戶數據文件
AuthUserFile /usr/local/proftpd/etc/ftpd.passwd
# 指定虛擬組數據文件
AuthGroupFile /usr/local/proftpd/etc/ftpd.group
# ***除wheel組外其它所有組只能訪問home目錄內容,這裡wheel需要在ftpd.group中定義
DefaultRoot ~ !wheel
# 雖然默認情況root不能ftp,但我仍然顯式地聲明它,也方便隨時開啟這個功能。
RootLogin off
<Limit SITE_CHMOD>
DenyAll
</Limit>
<Anonymous ~ftp>
User ftp
Group ftp

# We want clients to be able to login with "anonymous" as well as "ftp"
UserAlias anonymous ftp

# Limit the maximum number of anonymous logins,禁用匿名FTP
MaxClients none "Sorry, anonymous is refused on this site!"

# We want 'welcome.msg' displayed at login, and '.message' displayed
# in each newly chdired directory.
DisplayLogin welcome.msg
DisplayFirstChdir .message

# Limit WRITE everywhere in the anonymous chroot
<Limit WRITE>
DenyAll
</Limit>
</Anonymous>原文地址:http://kerry.blog.51cto.com/172631/236036

[火星人 ] freebsd下安裝proftpd已經有836次圍觀

http://coctec.com/docs/service/show-post-13726.html