歡迎您光臨本站 註冊首頁

proftp 1.3.1 新用戶自動創建主目錄

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

proftp 1.3.1 新用戶自動創建主目錄

proftpd-1.3.1 編譯好後,可以正常啟動和運用。

編譯過程:
./configure --enable-ctrls --with-modules=mod_sql:mod_sql_mysql:mod_quotatab:mod_quotatab_sql --with-includes=/usr/include/mysql --with-libraries=/usr/lib/mysql
make;make install
參考了:http://www.stksky.com/redirect.php?tid=46308&goto=lastpost

但是有一點不知道是不是我設置錯誤了,就是新用戶不能自動建立目錄。

mysql> select * from ftpusers;
+-----+--------+--------+------+------+---------------------+---------------+-------+-----------+---------------------+
| id  | userid | passwd | uid  | gid  | homedir             | shell         | count | host      | lastlogin           |
+-----+--------+--------+------+------+---------------------+---------------+-------+-----------+---------------------+
| 502 | admin  | admin  | 5500 | 5500 | /home/ftpdata/admin | /sbin/nologin |     1 | 127.0.0.1 | 2008-01-12 08:40:09 |

比如上面,我增加一個admin用戶,目錄為/home/ftpdata/admin。

這個時候我需要mkdir  /home/ftpdata/admin  然後chown權限才可以正常使用,不然的話會提示下面錯誤。我記得我以前裝過proftp是會自動創建目錄的。

Jan 12 08:39:02 sznetwork proftpd sznetwork (127.0.0.1): USER admin: Login successful.
Jan 12 08:39:02 sznetwork proftpd sznetwork (127.0.0.1): notice: unable to use '~/' : No such file or directory
Jan 12 00:39:02 sznetwork proftpd sznetwork (127.0.0.1): Preparing to chroot to directory '~/'
Jan 12 00:39:02 sznetwork proftpd sznetwork (127.0.0.1): admin chroot("~/"): No such file or directory
Jan 12 00:39:02 sznetwork proftpd sznetwork (127.0.0.1): error: unable to set default root directory
Jan 12 00:39:02 sznetwork proftpd sznetwork (127.0.0.1): FTP session closed.

下面是我的proftpd.conf。

# cat  /usr/local/etc/proftpd.conf
ServerName                      "SZHY  FTP"
ServerType                      standalone
ServerAdmin                     xx@xx.com
DefaultServer                    on
Port                            21
Umask                           022
MaxInstances                    100
User                            nobody
Group                           nobody
MaxClients                       100
DisplayLogin                    welcome.msg
DisplayChdir                    .message
MaxHostsPerUser                 5
MaxClientsPerUser               10
MaxClientsPerHost               10
RootLogin                       off
RequireValidShell               off
UseReverseDNS                   off
IdentLookups                    off
TimeoutStalled                  600
TimeoutLogin                    900
TimeoutIdle                     600
TimeoutNoTransfer               600
AllowForeignAddress             on
PassivePorts                    61000 62999
AllowStoreRestart               on
AllowRetrieveRestart            on
AllowOverwrite                  on
ServerIdent                     off
DefaultRoot                      ~ ftpgroup

#Log Set
SyslogLevel emerg
SystemLog /var/log/proftpd.system.log
TransferLog /var/log/proftpd.xferlog
LogFormat default "%h %l %u %t "%r" %s %b"
LogFormat auth "%v [%P] %h %t "%r" %s"
LogFormat write "%h %l %u %t "%r" %s %b"
ExtendedLog /var/log/proftpd.auth_log AUTH auth
ExtendedLog /var/log/proftpd.paranoid_log ALL default

#MySQL Auth Set
SQLAuthTypes Backend Plaintext
SQLAuthenticate users* groups*
SQLConnectInfo proftp@localhost proftpsqluser proftpsqluser
SQLUserInfo ftpusers userid passwd uid gid homedir shell
SQLGroupInfo ftpgroups groupname gid members
SQLNegativeCache   on
SQLLogFile /var/log/proftpd.sql.log
SQLNamedQuery getcount SELECT "count from ftpusers where userid='%u'"
SQLNamedQuery getlastlogin SELECT "lastlogin from ftpusers where userid='%u'"
SQLNamedQuery updatelogininfo UPDATE "count=count+1,host='%h',lastlogin=current_timestamp() WHERE userid='%u'" ftpusers
SQLShowInfo PASS "230" "You've logged on %{getcount} times, last login at %{getlastlogin}"
SQLLog PASS updatelogininfo


#MySQL Quota Set
QuotaEngine on
QuotaDirectoryTally on
QuotaDisplayUnits Mb
QuotaShowQuotas on
QuotaLog "/var/log/proftpd.quota.log"
SQLNamedQuery get-quota-limit SELECT "name, quota_type, per_session, limit_type, bytes_in_avail, bytes_out_avail, bytes_xfer_avail, files_in_avail, files_out_avail, files_xfer_avail FROM ftpquotalimits WHERE name = '%{0}' AND quota_type = '%{1}'"
SQLNamedQuery get-quota-tally SELECT "name, quota_type, bytes_in_used, bytes_out_used, bytes_xfer_used, files_in_used, files_out_used, files_xfer_used FROM ftpquotatallies WHERE name = '%{0}' AND quota_type = '%{1}'"
SQLNamedQuery update-quota-tally UPDATE "bytes_in_used = bytes_in_used + %{0}, bytes_out_used = bytes_out_used + %{1}, bytes_xfer_used = bytes_xfer_used + %{2}, files_in_used = files_in_used + %{3}, files_out_used = files_out_used + %{4}, files_xfer_used = files_xfer_used + %{5} WHERE name = '%{6}' AND quota_type = '%{7}'" ftpquotatallies
SQLNamedQuery insert-quota-tally INSERT "%{0}, %{1}, %{2}, %{3}, %{4}, %{5}, %{6}, %{7}" ftpquotatallies
QuotaLimitTable sql:/get-quota-limit
QuotaTallyTable sql:/get-quota-tally/update-quota-tally/insert-quota-tally

[ 本帖最後由 楓影誰用了 於 2008-1-12 09:01 編輯 ]

[火星人 ] proftp 1.3.1 新用戶自動創建主目錄已經有549次圍觀

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