-
互聯(lián)網(wǎng)安全法,互聯(lián)網(wǎng)凈網(wǎng)行動(dòng)
-
”凈網(wǎng)2020”落實(shí)好維護(hù)網(wǎng)絡(luò)安全責(zé)任
-
關(guān)于端午節(jié)放假通知-宇眾網(wǎng)絡(luò)
-
宇眾網(wǎng)絡(luò)春節(jié)放假通知
-
關(guān)于公司收款銀行賬戶變更通知函-宇眾網(wǎng)絡(luò)
-
關(guān)于網(wǎng)上有人冒充我公司名義進(jìn)行詐騙的公告。
-
關(guān)于端午節(jié)放假通知,節(jié)日放假,但是我們業(yè)務(wù)不“放假”-宇眾網(wǎng)絡(luò)
-
工信部進(jìn)一步加強(qiáng)未備案網(wǎng)站管理工作的通知-宇眾網(wǎng)絡(luò)
-
關(guān)于東莞市宇眾網(wǎng)絡(luò)科技有限公司香港數(shù)據(jù)中心(香港機(jī)房)路由優(yōu)化通知
-
宇眾網(wǎng)絡(luò)慶祝五·一勞動(dòng)節(jié)快樂
-
東莞東城機(jī)房網(wǎng)絡(luò)升級(jí)通知
-
臨近過(guò)年,互聯(lián)網(wǎng)IDC貴圈也有被騙的,請(qǐng)認(rèn)準(zhǔn)宇眾網(wǎng)絡(luò)公司官方聯(lián)系方式
-
我司已獲得ISP/ICP/IDC三證資格,更好的為客戶服務(wù)
-
關(guān)于浙江金華高防機(jī)房網(wǎng)絡(luò)線路切割通知
-
工信部近日下發(fā)關(guān)于進(jìn)一步規(guī)范域名備案工作的通知
行業(yè)資訊
- 首頁(yè)
- 新聞中心
- 行業(yè)資訊
Ubuntu16.04 ftp服務(wù)器安裝+配置
ftp服務(wù)器安裝與配置
1. ftp服務(wù)端的安裝
如果之前配置過(guò)ftp服務(wù)器的還是之后配置的服務(wù)器,無(wú)法啟動(dòng)服務(wù),那么基本是配置出現(xiàn)了錯(cuò)誤,那么可先完全卸載后再進(jìn)行安裝。如果無(wú)法定位多半是鏡像源的問(wèn)題,請(qǐng)更換阿里源。
-
sudo apt-get update
-
sudo apt-get install vsftpd
-
vsftpd --version //檢測(cè)是否安裝
2. ftp服務(wù)端的配置
vim /etc/vsftpd.conf //編輯配置文件
修改vsftpd.conf文件如下:
-
listen=NO //是否開啟監(jiān)聽ipv4和ipv6數(shù)據(jù)
-
listen_ipv6=YES //是否開啟監(jiān)聽ipv6數(shù)據(jù)
-
-
# Allow anonymous FTP? (Disabled by default).
-
anonymous_enable=NO //是否允許匿名登陸,無(wú)需密碼
-
-
# Uncomment this to allow local users to log in.
-
local_enable=YES //是否允許本地用戶登錄
-
-
# Uncomment this to enable any form of FTP write command.
-
write_enable=YES //是否允許登陸者上傳文件
-
-
# Default umask for local users is 077. You may wish to change this to 022,
-
# if your users expect that (022 is used by most other ftpd's)
-
local_umask=022 //設(shè)置本地用戶默認(rèn)要減免的權(quán)限
-
-
# Activate directory messages - messages given to remote users when they
-
# go into a certain directory.
-
dirmessage_enable=YES //目錄消息,能夠給遠(yuǎn)程登陸的用戶發(fā)送目錄
-
#
-
# If enabled, vsftpd will display directory listings with the time
-
# in your local time zone. The default is to display GMT. The
-
# times returned by the MDTM FTP command are also affected by this
-
# option.
-
use_localtime=YES //服務(wù)器所展示的目錄將隨著本地時(shí)間而改變
-
#
-
# Activate logging of uploads/downloads.
-
xferlog_enable=YES //開啟上傳下載的日志記錄
-
#
-
# Make sure PORT transfer connections originate from port 20 (ftp-data).
-
connect_from_port_20=YES //確認(rèn)連接傳輸?shù)亩丝谔?hào)為20
-
-
# You may override where the log file goes if you like. The default is shown
-
# below.
-
xferlog_file=/var/log/vsftpd.log //日志文件存放位置
-
#
-
# If you want, you can have your log file in standard ftpd xferlog format.
-
# Note that the default log file location is /var/log/xferlog in this case.
-
xferlog_std_format=YES //日志文件采用標(biāo)準(zhǔn)格式
-
-
-
# You may fully customise the login banner string:
-
ftpd_banner=Welcome to FTP service. //在使用shell時(shí)登陸那么會(huì)發(fā)送歡迎語(yǔ)
-
-
-
# You may specify an explicit list of local users to chroot() to their home
-
# directory. If chroot_local_user is YES, then this list becomes a list of
-
# users to NOT chroot().
-
# (Warning! chroot'ing can be very dangerous. If using chroot, make sure that
-
# the user does not have write access to the top level directory within the
-
# chroot)
-
chroot_local_user=YES //對(duì)本地用戶是否實(shí)施限制
-
chroot_list_enable=YES //開啟限制白名單
-
# (default follows)
-
chroot_list_file=/etc/vsftpd.chroot_list //白名單路徑,若無(wú)這個(gè)文件需要自己創(chuàng)建
-
-
# This option should be the name of a directory which is empty. Also, the
-
# directory should not be writable by the ftp user. This directory is used
-
# as a secure chroot() jail at times vsftpd does not require filesystem
-
# access.
-
secure_chroot_dir=/var/run/vsftpd/empty
-
#
-
# This string is the name of the PAM service vsftpd will use.
-
# pam_service_name=vsftpd
-
pam_service_name=ftp //此處ubuntu的系統(tǒng)需要改為ftp
-
-
# This option specifies the location of the RSA certificate to use for SSL
-
# encrypted connections.
-
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
-
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
-
ssl_enable=NO
-
-
#
-
# Uncomment this to indicate that vsftpd use a utf8 filesystem.
-
utf8_filesystem=YES //編碼統(tǒng)一為utf8編碼,可以識(shí)別中文,防止亂碼
3. vftpd配置完成
添加設(shè)置ftpuser用戶和訪問(wèn)目錄
1. 創(chuàng)建ftp用戶組和用戶
-
sudo groupadd ftpusers //創(chuàng)建ftpusers用戶組
-
sudo useradd -m ftpuser_lxr//創(chuàng)建一個(gè)用戶并且自動(dòng)創(chuàng)建家目錄為/home/ftpuser_lxr
-
(第二種方式:mkdir /home/ftpuser_lxr //先創(chuàng)建家目錄sudo userad -d /home/ftpuser_lxr ftpuser_lxr //綁定這個(gè)家目錄)
-
usermod -G ftpusers ftpuser_lxr //將這個(gè)新用戶加入到ftpusers用戶組中
-
sudo passwd ftpuser_lxr //更改密碼
-
mkdir /home/ftpuser_lxr/ftp //為用戶添加一個(gè)具有一定權(quán)限的文件夾
-
chmod 777 -R /home/ftpuser_lxr/ftp //新建一個(gè)pub目錄用于存放文件,并且賦予全部權(quán)限
-
usermod -s /sbin/nologin username //限制用戶登錄方式;限制用戶username只能通過(guò)ftp登陸,而不能直接登陸服務(wù)器
2.將該用戶加入vsftpd.chroot_list白名單中
-
mkdir /etc/vsftpd.chroot_list
-
vim vsftpd.chroot_list
該文件內(nèi)容如下:
-
#白名單
-
ftpuser_lxr
3.開啟并重啟vsftpd的服務(wù)
systemctl start vsftpd或者service vsftpd start
systemctl restart vsftpd或者service vsftpd restart
測(cè)試
方法一:
打開瀏覽器,在地址欄輸入:ftp://ip_addresss
方法二:
在ubuntu中使用shell輸入:ftp ip_address
方法三:
在windows中在文件管理器地址欄輸入:ftp://ip_addresss,該方式可以上傳下載文件
方法四:
在windows中使用cmd輸入:ftp://ip_addresss //顯示連接成功