ubuntu vsftpd教學

作業系統版本與軟體版本如下
作業系統
版本
Ubuntu Server
16.04.03

軟體
版本
vsftpd
3.0.3

實體帳戶需求
  1. 帳戶權限只能讀寫自己家目錄
  2. 不能看到別人帳戶的目錄檔案或者系統目錄
  3. 實體帳戶不能登入系統
Vsftpd.conf 設定

Step 1

首先打開terminals 輸入ssh cba@serverip
輸入密碼連線至server

Step 2

sudo apt-get install vsftpd

Step 3

sudo vim /etc/vsftp.conf
鍵盤輸入i進入編輯模式,以下紅色字為要修改部份綠字要增加部份
修改完按ESC鍵輸入:WQ
實體帳戶設定

# 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
# 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
chroot_list_enable=YES
# (default follows)
chroot_list_file=/etc/vsftpd.chroot_list
#允許家目錄變為根目錄後擁有寫入權限
allow_writeable_chroot = YES
Server 常用設定
# Activate logging of uploads/downloads.
#啟用上傳/下載日誌
xferlog_enable=YES
# 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 format 紀錄日誌,注意存放位置 /var/log/xferlog
xferlog_std_format=YES

Step 4

新增帳戶
useradd -m -s /usr/sbin/nologin test
Passwd test
-m:建立使用者家目錄
-s :建立使用者登入Shell類型
關於使用者管理要深入了解可以參考鳥哥

Step 5

sudo vim /etc/shells
鍵盤輸入i進入編輯模式
在最下面一行加入/usr/sbin/nologin
修改完按ESC鍵輸入:WQ
關於shells要深入了解可以參考鳥哥

Step 6

建立 vsftpd.chroot_list
sudo vim /etc/vsftpd.chroot_list
鍵盤輸入i進入編輯模式
如果不被chroot的實體帳戶可寫入此清單
修改完按ESC鍵輸入:WQ

Step 7

sudo /etc/init.d/vsftpd restart

Step 8

測試
FTP Server 建置完成後,FTP Client如果是使用Windows 建議安裝FileZilla Client使用,
因為Windows語言編碼是Big5 ,FTP server是UTF-8碼,
Windows 如果使用檔案管理連FTP作上傳檔案,
測試結果是傳上去後重新整理會顯示檔名亂碼,
用Ubuntu連上FTP-Server看剛剛windows 上傳完檔名也是亂碼。
使用Filezilla Clinet使用步驟如下FileZilla Client安裝
完後開啟程式並在站台管理員頁面上新增站台後
將字碼集選強制使用UTF-8 確定後在連至 FTP Server作 上傳/下載檔案。



文章變更日誌
2017/12/11:使用Ubuntu OS 與Windows OS當 FTP Clinet
連至FTP-Server 作上傳/下載檔案測試並將過程寫至測試段落

留言

這個網誌中的熱門文章

Google 文件教學-無法刪除空白頁?教你2種情境4種方法刪除惱人空白頁!!

Google 文件教學-段落第一行空兩格

Google 文件教學-看完這篇快速搞定編號清單

Google 文件教學-如何免費取得內建範本

Google 文件教學-如何使用文字藝術師?