Xshell利用Xftp傳輸文件,使用pure-ftpd搭建ftp服務

Xftp傳輸文件

若是已經經過Xshell登陸到服務器,此時能夠使用快捷鍵ctrl+alt+f 打開Xftp並展現Xshell當前的目錄,以後直接拖拽傳輸文件便可。
python

pure-ftpd搭建ftp服務

pure-ftpd要比vsftp簡單,輕量shell

安裝pure-ftpd,安裝報錯了,從網上知道了是python的urlgrabber腳本有bugvim

[root@test-a vsftpd_user_conf]# yum install -y pure-ftpd
Loaded plugins: fastestmirror
base                                                                 | 3.6 kB  00:00:00
epel/x86_64/metalink                                                 | 7.0 kB  00:00:00
epel                                                                 | 3.2 kB  00:00:00
extras                                                               | 3.4 kB  00:00:00
updates                                                              | 3.4 kB  00:00:00
Traceback (most recent call last):
  File "/usr/libexec/urlgrabber-ext-down", line 75, in <module>
    main()
  File "/usr/libexec/urlgrabber-ext-down", line 61, in main
    fo = PyCurlFileObject(opts.url, opts.filename, opts)
  File "/usr/lib/python2.7/site-packages/urlgrabber/grabber.py", line 1258, in __init__
    self._do_open()primary      0% [                      ]  0.0 B/s |    0 B  --:--:-- ETA
  File "/usr/lib/python2.7/site-packages/urlgrabber/grabber.py", line 1589, in _do_open
    self._do_grab()
  File "/usr/lib/python2.7/site-packages/urlgrabber/grabber.py", line 1723, in _do_grab
    self._do_perform()
  File "/usr/lib/python2.7/site-packages/urlgrabber/grabber.py", line 1517, in _do_perform
    raise KeyboardInterrupt
KeyboardInterrupt


Exiting on user cancel


# 解決錯誤
[root@test-a ~]# vim /usr/lib/python2.7/site-packages/urlgrabber/grabber.py  
#elif errcode in (42, 55, 56): 找到這行換成下面的,再次安裝便可
#elif errcode in [42]:

[root@test-a ~]# yum install -y pure-ftpd

配置及測試:服務器

# 先把以前的ftpd服務關了
[root@test-a ~]# systemctl stop vsftpd.service

[root@test-a ~]# vim /etc/pure-ftpd/pure-ftpd.conf # 搜索pureftpd.pdb,去掉這行前面的#

# 啓動服務
[root@test-a ~]# systemctl start pure-ftpd
# 查看服務
[root@test-a ~]# netstat -ntlp | grep ftp
tcp        0      0 0.0.0.0:21              0.0.0.0:*               LISTEN      19022/pure-ftpd (SE
tcp6       0      0 :::21                   :::*                    LISTEN      19022/pure-ftpd (SE


[root@test-a ~]# useradd ftpuser02
[root@test-a ~]# mkdir /tmp/pureftp
[root@test-a ~]# chown -R ftpuser02:ftpuser02 /tmp/pureftp/
[root@test-a ~]# pure-pw useradd virftpuser02 -u ftpuser02 -d /tmp/pureftp/  # virftpuser02 虛擬用戶,-u 指定對應的真實用戶 -d分享目錄
Password:
Enter it again:
[root@test-a ~]# pure-pw mkdb # 使密碼生成系統須要的二進制形式
[root@test-a ~]# touch /tmp/pureftp/1111.txt # 建立測試文件
[root@test-a ~]# lftp virftpuser02@127.0.0.1 # 登陸測試
Password:
lftp virftpuser02@127.0.0.1:~> ls
drwxr-xr-x    2 1010       ftpuser02          21 Dec 12 09:56 .
drwxr-xr-x    2 1010       ftpuser02          21 Dec 12 09:56 ..
-rw-r--r--    1 0          0                   0 Dec 12 09:56 1111.txt
lftp virftpuser02@127.0.0.1:/>
相關文章
相關標籤/搜索