當前位置:首頁 > 嵌入式 > 嵌入式軟件
[導讀]與非網(EEFOCUS)電子產業(yè)社區(qū)平臺為中國電子行業(yè)首家采用強大技術平臺,由專業(yè)的電子技術編輯服務,為全球3000家知名半導體廠家及電子技術系統(tǒng)廠商提供技術信息發(fā)布、廠商網站、技術社區(qū)建設服務,并以電子術語詞典,集成電路數據手冊查詢,電子產品新聞訪談資訊信息以及互動技術交流社區(qū)為上百萬電子技術工程師以及高校師生提供最完整的電子技術信息查詢和交流服務。

作者:llzqq
聯系:llzqq@126.com
來自:www.chinaunix.net

在眾多的FTP服務器中PROFTPD由于它的配置靈活,安裝簡便。近年來一直受到人們的喜愛。通常情況下FTP包括認證過程,傳輸是明文傳輸的,在傳輸一些敏感數據時總是不能讓人放心。今天我在網上找了一些零散的資料結合自己的實作寫了個帖子貢獻給大家。

下載最新的軟件版本:

# wget ftp://ftp.proftpd.org/distrib/source/proftpd-1.3.0rc3.tar.gz

首先創(chuàng)建ROFTPD運行的用戶和組:

# groupadd nogroup
# useradd –g nogroup –d /dev/null –s /sbin/nologin nobody

首先創(chuàng)建上傳下載的用戶和組:

# groupadd ftp
# useradd –g ftp –d /home/down –s /sbin/nologin down
# useradd –g ftp –d /home/upload –s /sbin/nologin upload
用戶密碼設置略

編譯安裝PROFRPD:

# tar –zxvf proftpd-1.3.0rc3.tar.gz
# cd proftpd-1.3.0rc3
# ./configure
--prefix=/usr/local/proftpd
--sysconfdir=/etc
--enable-autoshadow
--localstatedir=/var/run
--enable-ctrls
--with-modules=mod_tls

# make
# make install

配置PROFTPD服務器:

# vi /etc/proftpd.conf
================+================+=================
# This is a basic ProFTPD configuration file (rename it to
# ‘proftpd.conf‘ for actual use. It establishes a single server
# and a single anonymous login. It assumes that you have a user/group
# "nobody" and "ftp" for normal operation and anon.
ServerName "llzqq"
ServerType standalone
DefaultServer on
AllowRetrieveRestart on
AllowStoreRestart on
ServerType standalone
ServerIdent on
SystemLog /var/log/proftpd.log
UseReverseDNS off
IdentLookups off
RequireValidShell off
# Port 21 is the standard FTP port.
Port 21
# Umask 022 is a good standard umask to prevent new dirs and files
# from being group and world writable.
Umask 022
MaxInstances 100
# Set the user and group under which the server will run.
User nobody
Group nogroup
# To cause every FTP user to be "jailed" (chrooted) into their home
# directory, uncomment this line.
DefaultRoot ~
# Normally, we want files to be overwriteable.
<Directory />
AllowOverwrite on
</Directory>
# We want ‘welcome.msg‘ displayed at login, and ‘.message‘ displayed
# in each newly chdired directory.
DisplayLogin .welcome
DisplayFirstChdir .message
# Limit User of being enbled login ftp server
<Limit LOGIN>
AllowGroup ftp
DenyAll
</Limit>
#########################ssl/tls############################
# MOD_TLS SETTING
<IfModule mod_tls.c>
TLSEngine on
TLSLog /var/log/proftpd-tls.log
TLSProtocol SSLv23
# Are clients required to use FTP over TLS when talking to this server?
TLSRequired ctrl
# Server‘s certificate
TLSRSACertificateFile /etc/proftpd.crt
TLSRSACertificateKeyFile /etc/proftpd.key
# Authenticate clients that want to use FTP over TLS
TLSVerifyClient off
#########################ssl/tls############################
<Directory /home/down>
<Limit WRITE>
DenyGroup ftp
</Limit>
TransferRate RETR 150 group ftp
</Directory>
<Directory /home/upload>
<Limit RMD RNFR DELE RETR>
DenyGroup ftp
</Limit>
TransferRate STOR 150 group ftp
</Directory>
MaxClientsPerHost 200
PassivePorts 55000 56000
================+================+=================

創(chuàng)建PROFTPD的日志文件:

# touch /var/log/proftpd.log
# touch /var/log/proftpd-tls.log
# chown nobody:nogroup /var/log/proftpd.log /var/log/proftpd-tls.log

創(chuàng)建SSL傳輸的證書和密匙:

# cp /usr/share/ssl/openssl.cnf ./
# openssl req -new -x509 -nodes -config openssl.cnf -out proftpd.crt –keyout proftpd.key
這里安裝提示需要輸入證書信息略

把證書和密匙復制到指定目錄:
# cp proftpd.crt proftpd.key /etc/

最后創(chuàng)建PROFTPD啟動教本:

# vi /etc/init.d/proftpd
================+================+=================
#!/bin/sh
# Startup script for ProFTPD
# chkconfig: 345 85 15
# description: ProFTPD is an enhanced FTP server
# processname: proftpd
# config: /etc/proftpd.conf
# Source function library.
. /etc/rc.d/init.d/functions

if [ -f /etc/sysconfig/proftpd ]; then
. /etc/sysconfig/proftpd
fi
PATH="$PATH:/usr/local/proftpd/sbin"
# See how we were called.
case "$1" in
start)
echo -n "Starting proftpd: "
daemon proftpd $OPTIONS
echo
touch /var/lock/subsys/proftpd
;;
stop)
echo -n "Shutting down proftpd: "
killproc proftpd
echo
rm -f /var/lock/subsys/proftpd
;;
status)
status proftpd
;;
restart)
$0 stop
$0 start
;;
reread)
echo -n "Re-reading proftpd config: "
killproc proftpd -HUP
echo
;;
suspend)
hash ftpshut >/dev/null 2>&1
if [ $? = 0 ]; then
if [ $# -gt 1 ]; then
shift
echo -n "Suspending with ‘$*‘ "
ftpshut $*
else
echo -n "Suspending NOW "
ftpshut now "Maintanance in progress"
fi
else
echo -n "No way to suspend "
fi
echo
;;
resume)
if [ -f /etc/shutmsg ]; then
echo -n "Allowing sessions again "
rm -f /etc/shutmsg
else
echo -n "Was not suspended "
fi
echo
;;
*)
echo -n "Usage: $0 {start|stop|restart|status|reread|resume"
hash ftpshut
if [ $? = 1 ]; then
echo ‘}‘
else
echo ‘|suspend}‘
echo ‘suspend accepts additional arguments which are passed to ftpshut(8)‘
fi
exit 1
esac

if [ $# -gt 1 ]; then
shift
$0 $*
fi
exit 0
================+================+=================

# chomd 755 /etc/init.d/proftpd
# chkconfig –-add proftpd
# chkconfig proftpd on

到這里ftp服務器端安裝設置完畢,登陸服務器的客戶端我用了完全免費的FileZilla(前兩天網上看到說FileZilla支持SSL不錯)。FileZilla的設置也比較簡單。本服務器支持兩種客戶端加密連接方式:

1. FTP over ssl (顯示加密)方式連接。
2. FTP over tls (顯示加密) 方式連接

本站聲明: 本文章由作者或相關機構授權發(fā)布,目的在于傳遞更多信息,并不代表本站贊同其觀點,本站亦不保證或承諾內容真實性等。需要轉載請聯系該專欄作者,如若文章內容侵犯您的權益,請及時聯系本站刪除。
換一批
延伸閱讀

9月2日消息,不造車的華為或將催生出更大的獨角獸公司,隨著阿維塔和賽力斯的入局,華為引望愈發(fā)顯得引人矚目。

關鍵字: 阿維塔 塞力斯 華為

加利福尼亞州圣克拉拉縣2024年8月30日 /美通社/ -- 數字化轉型技術解決方案公司Trianz今天宣布,該公司與Amazon Web Services (AWS)簽訂了...

關鍵字: AWS AN BSP 數字化

倫敦2024年8月29日 /美通社/ -- 英國汽車技術公司SODA.Auto推出其旗艦產品SODA V,這是全球首款涵蓋汽車工程師從創(chuàng)意到認證的所有需求的工具,可用于創(chuàng)建軟件定義汽車。 SODA V工具的開發(fā)耗時1.5...

關鍵字: 汽車 人工智能 智能驅動 BSP

北京2024年8月28日 /美通社/ -- 越來越多用戶希望企業(yè)業(yè)務能7×24不間斷運行,同時企業(yè)卻面臨越來越多業(yè)務中斷的風險,如企業(yè)系統(tǒng)復雜性的增加,頻繁的功能更新和發(fā)布等。如何確保業(yè)務連續(xù)性,提升韌性,成...

關鍵字: 亞馬遜 解密 控制平面 BSP

8月30日消息,據媒體報道,騰訊和網易近期正在縮減他們對日本游戲市場的投資。

關鍵字: 騰訊 編碼器 CPU

8月28日消息,今天上午,2024中國國際大數據產業(yè)博覽會開幕式在貴陽舉行,華為董事、質量流程IT總裁陶景文發(fā)表了演講。

關鍵字: 華為 12nm EDA 半導體

8月28日消息,在2024中國國際大數據產業(yè)博覽會上,華為常務董事、華為云CEO張平安發(fā)表演講稱,數字世界的話語權最終是由生態(tài)的繁榮決定的。

關鍵字: 華為 12nm 手機 衛(wèi)星通信

要點: 有效應對環(huán)境變化,經營業(yè)績穩(wěn)中有升 落實提質增效舉措,毛利潤率延續(xù)升勢 戰(zhàn)略布局成效顯著,戰(zhàn)新業(yè)務引領增長 以科技創(chuàng)新為引領,提升企業(yè)核心競爭力 堅持高質量發(fā)展策略,塑強核心競爭優(yōu)勢...

關鍵字: 通信 BSP 電信運營商 數字經濟

北京2024年8月27日 /美通社/ -- 8月21日,由中央廣播電視總臺與中國電影電視技術學會聯合牽頭組建的NVI技術創(chuàng)新聯盟在BIRTV2024超高清全產業(yè)鏈發(fā)展研討會上宣布正式成立。 活動現場 NVI技術創(chuàng)新聯...

關鍵字: VI 傳輸協議 音頻 BSP

北京2024年8月27日 /美通社/ -- 在8月23日舉辦的2024年長三角生態(tài)綠色一體化發(fā)展示范區(qū)聯合招商會上,軟通動力信息技術(集團)股份有限公司(以下簡稱"軟通動力")與長三角投資(上海)有限...

關鍵字: BSP 信息技術
關閉
關閉