騰迅CentOS雲端服務器安裝配置ftp伺服器

來源:互聯網
上載者:User

使用者需要使用FTP通道,將應用程式從使用者自己的伺服器上傳到雲端服務器上。
本文介紹本地環境為Windows,如何將應用程式上傳到CentOS雲端服務器。

Step1. 在雲端服務器配置FTP服務

1. 在root許可權下,通過如下命令安裝Vsftp。

[root@VM_250_202_tlinux ~]# yum install vsftpd

2. 在啟動vsftpd服務之前,需要登入雲端服務器修改設定檔,將匿名登入禁用掉。
開啟設定檔,命令如下:

[root@VM_250_202_tlinux ~]# vim /etc/vsftpd/vsftpd.conf

在設定檔中第11行的“anonymous_enable=YES”前面加上#號,即將匿名登入禁用。

3. 讀取生效配置。

[root@VM_250_202_tlinux ~]# cat /etc/vsftpd/vsftpd.conf |grep ^[^#]
local_enable=YES
write_enable=YES
local_umask=022
anon_upload_enable=YES
anon_mkdir_write_enable=YES
anon_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
listen=YES
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES

4. 啟動vsftpd服務。

[root@VM_250_202_tlinux ~]# service vsftpd start

5. 設定FTP使用者帳號。設定成功後,即可通過該帳號登入FTP伺服器。

(1)設定FTP使用者的帳號,例如帳號為“ftpuser1”,目錄為/home/ftpuser1,且設定不允許通過ssh登入。
[root@VM_250_202_tlinux ~]# useradd -d /home/ftpuser1 -s /sbin/nologin ftpuser1

(2)設定帳號對應的密碼,例如密碼為“ftpuser1”

[root@VM_250_202_tlinux ~]# passwd ftpuser1

6. 修改vsftpd的pam配置,使使用者可以通過自己設定的FTP使用者帳號和密碼串連到雲端服務器。

(1)修改pam。

[root@VM_250_202_tlinux ~]# vim /etc/pam.d/vsftpd

內容修改為:

#%PAM-1.0
auth required /lib64/security/pam_listfile.so item=user sense=deny file=/etc/ftpusers onerr=succeed
auth required /lib64/security/pam_unix.so shadow nullok
auth required /lib64/security/pam_shells.so
account required /lib64/security/pam_unix.so
session required /lib64/security/pam_unix.so

(2)確認修改後的檔案是否正確。

[root@VM_250_202_tlinux ~]# cat /etc/pam.d/vsftpd #%PAM-1.0
auth required /lib64/security/pam_listfile.so item=user sense=deny file=/etc/ftpusers onerr=succeed
auth required /lib64/security/pam_unix.so shadow nullok
auth required /lib64/security/pam_shells.so
account required /lib64/security/pam_unix.so
session required /lib64/security/pam_unix.so

(3)重啟vsftpd服務,使修改生效。

[root@VM_250_202_tlinux ~]# service vsftpd restart
Shutting down vsftpd: [ OK ]
Starting vsftpd for vsftpd: [ OK ]

Step2. 下載並安裝開源軟體FileZilla

請使用FileZilla的3.5.1、3.5.2版本(使用3.5.3版本的FileZilla進行FTP上傳會有問題)。
由於FileZilla 官網上只提供了最新的3.5.3版本下載,因此建議使用者自行搜尋3.5.1、3.5.2下載地址。
建議的3.5.1 下載地址:http://www.oldapps.com/filezilla.php?old_filezilla=6350

Step3. 串連FTP

運行FileZilla,按下圖所示進行配置,配置後點擊“快速連結”:

配置資訊說明如下:

(1)主機:雲端服務器的公網IP(在雲端服務器“管理檢視”頁面可查看雲端服務器的公網IP)。
(2)使用者名稱:在Step1中設定的FTP使用者的帳號,這裡以“ftpuser1”為例。
(3)密碼:在Step1中設定的FTP使用者帳號對應的密碼,這裡以“ftpuser1”為例。
(4)連接埠:FTP監聽連接埠,預設為“21”。

Step4. 上傳檔案到CentOS雲端服務器

上傳檔案時,滑鼠選中本地檔案,拖拽到遠端站台,即將檔案上傳到了CentOS雲端服務器。

注意:

雲端服務器FTP通道不支援上傳tar壓縮包後自動解壓,以及刪除tar包功能。

上傳檔案示意圖如下所示:

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.