close

SFTP 感覺上比 FTP 要來得安全些,其實 vsFTPD 已經很好用了,但老大就是要用 SFTP ,所以就去搜尋了一下,發現新版的 OpenSSH 也可以用 SFTP ,也實做OK,但是一直卡在 Log ,所以就回頭找 FTP 服務的軟體,剛好最新版本的 ProFTPD 有提供 SFTP 的功能,並且也修正了一些 Bug,所以就在幸運之神的眷顧下完成了。

1.到 ProFTPD 的官網 ( ftp://ftp.proftpd.org/distrib/source/ ) 下載最新的版本,我是下載 proftpd-1.3.3b.tar.gz

2. 解開 proftpd ,並進到該目錄

./configure \
--prefix=/usr/local --sysconfdir=/etc \
--localstatedir=/var/run --mandir=/usr/local/man \
--without-pam --disable-auth-pam --enable-openssl \
--enable-shadow --enable-autoshadow \
--with-modules=mod_ratio:mod_readme:mod_sftp

3.安裝

make && make install

4.安裝完時,在 /etc/init.d/ 沒有 proftpd ,自己建置

touch proftpd
chmod +x proftpd

內容如 http://www.proftpd.org/docs/howto/Stopping.html

這樣就可以用 /etc/init.d/proftpd start 來啟動 proftpd 了
並且在 /etc/rc.d/rc.local 下面加上一行 /etc/init.d/proftpd start

5.到 /etc/ssh/sshd_config 改 port 22 到其他 port

6.設定 /etc/proftpd.conf

port 22
SFTPEngine On
SFTPHostKey /etc/ssh/ssh_host_rsa_key
SFTPHostKey /etc/ssh/ssh_host_dsa_key

SetEnv TZ :/etc/localtime
TimesGMT off

SystemLog /var/log/proftpd/proftpd.log
LogFormat myxfer "%{%Y/%m/%d %H:%M:%S}t [%u] \"%m %f\" (%bB/%TS)"
LogFormat myauth "%{%Y/%m/%d %H:%M:%S}t [%u] \"%r\": %S (%a)"
ExtendedLog /var/log/proftpd/login.log auth myauth
ExtendedLog /var/log/proftpd/transfer.log read,write myxfer

7.到 /var/log

mkdir proftpd

8.重開機,讓 SSH, ProFTPD 同時啟動,這時 port 22 是給 ProFTPD 用,SSH 是用步驟 5 設定的 port

arrow
arrow
    全站熱搜

    linux988 發表在 痞客邦 留言(1) 人氣()