AWS announces preview of AWS Interconnect - multicloud
AWS announces AWS Interconnect – multicloud (preview), providing simple, resilient, high-speed private connections to other cloud service providers. AWS Interconnect - multicloud is easy to configure and provides high-speed, resilient connectivity with dedicated bandwidth, enabling customers to interconnect AWS networking services such as AWS Transit Gateway, AWS Cloud WAN, and Amazon VPC to other cloud service providers with ease.
如何在 Lightsail 執行個體上設定 FTP 伺服器和 FTP 使用者?
我想在執行 Amazon Linux 2、CentOS、Ubuntu 或 Debian 的 Amazon Lightsail 執行個體上設定檔案傳輸協定 (FTP) 伺服器和 FTP 使用者。
解決方法
**注意:**FTP 以純文字形式傳輸所有資料和密碼。SSH 檔案傳輸通訊協定 (SFTP) 是連線至執行個體並傳輸資料的更安全方式。如需使用 SFTP 的相關資訊,請參閱使用 SFTP 連線至 Amazon Lightsail 中的 Linux 或 Unix 執行個體。
設定 FTP 伺服器和 FTP 使用者
1. 執行下列命令,以安裝 VSFTPD 套件:
Amazon Linux 2 和 CentOS:
sudo yum install vsftpd -y
Ubuntu 和 Debian:
sudo apt install vsftpd -y
如果您收到指出套件無法使用的錯誤,請執行下列命令以更新套件清單:
sudo apt update -y
2. 編輯 vsftpd.config 檔案以更新環境的變數。
**vsftpd.config ** 檔案位置視您的作業系統而有所不同:
- Amazon Linux 2 和 CentOS:/etc/vsftpd/vsftpd.conf
- Debian 和 Ubuntu:/etc/vsftpd.conf
在下列範例中,更新您的使用案例的變數。下列參數是所有作業系統共用的。
anonymous_enable=NO local_enable=YES write_enable=YES dirmessage_enable=YES xferlog_enable=YES connect_from_port_20=NO xferlog_std_format=YES chroot_local_user=YES allow_writeable_chroot=YES listen=YES pam_service_name=vsftpd userlist_enable=YES userlist_deny=NO listen_port=10021 pasv_enable=YES pasv_min_port=21000 pasv_max_port=21999 pasv_addr_resolve=NO
注意:連接埠 21 是 FTP 的預設連接埠。但是,出於安全性原因,在上述範例中將自訂連接埠 10021 用作 FTP 的連接埠。若要自訂連接埠,請將 listen_port 變更為您想要的連接埠,然後將 connect_from_port_20 設定為 NO。請確定啟用您計劃在執行個體防火牆上用於 FTP 的連接埠。對於上述範例,連接埠 10021 和 21000-21999 會在自訂和 Lightsail 防火牆上啟動。此外,listen 和 listen_ipv6 參數不能同時存在於檔案中。更新您的組態檔案,以便僅有一個設定為是。
下列參數特定於作業系統。除了上述範例之外,還可為您的作業系統編輯下列變數。
Amazon Linux 2 和 CentOS
chroot_list_file=/etc/vsftpd/chroot_listuserlist_file=/etc/vsftpd/user_list
Debian 和 Ubuntu:
chroot_list_file=/etc/vsftpd.chroot_listuserlist_file=/etc/vsftpd.userlist
3. 執行下列命令以新增 FTP 使用者:
sudo useradd -m ftp_user
**注意:**在上述範例中,用您選擇的使用者名稱取代 ftp_user。
4. 執行下列命令,為使用者建立密碼:
sudo passwd ftp_user
5. 執行下列命令以變更 /home/ftp_user 檔案的所有權。此命令使 ftp_user 成為檔案所有者。
sudo chown ftp_user:ftp_user -R /home/ftp_user/
6. 執行下列命令,將新使用者新增到 vsftpd user_list 中。使用 -a 旗標附加到檔案中。
Amazon Linux 2 和 CentOS
sudo echo "ftp_user" | sudo tee -a /etc/vsftpd/user_list
Debian 和 Ubuntu
執行下列命令以建立 userlist 檔案,並將新使用者新增至檔案中:
sudo echo "ftp_user" | sudo tee -a /etc/vsftpd.userlist
7. 重新啟動 vsftpd 服務:
sudo systemctl restart vsftpd
8. 連線至 FTP 伺服器。下列範例使用 Filezilla 普通 FTP。
Status: Connecting to 54.xxx.xxx.x2:10021... Status: Connection established, waiting for welcome message... Status: Plain FTP is insecure. Please switch to FTP over TLS. Status: Logged in Status: Retrieving directory listing... Status: Server sent passive reply with unroutable address. Using server address instead. Status: Calculating timezone offset of server... Status: Timezone offset of server is 0 seconds. Status: Directory listing of "/" successful Status: Connecting to 54.xxx.1xx.52:10021... Status: Connection established, waiting for welcome message... Status: Plain FTP is insecure. Please switch to FTP over TLS. Status: Logged in Status: Starting upload of C:\Users\Administrator\Documents\FTPtest.txt Status: Server sent passive reply with unroutable address. Using server address instead. Status: File transfer successful, transferred 10 bytes in 1 second Status: Retrieving directory listing of "/"... Status: Server sent passive reply with unroutable address. Using server address instead. Status: Directory listing of "/" successful
FTP 伺服器設定疑難排解
如果 ** vsftpd.conf ** 組態檔的參數未正確設定,則 FTP 伺服器可能無法啟動。在此情況下,請執行下列命令以判斷未正確設定的選項:
Amazon Linux 2 和 CentOS
sudo /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf
Debian 和 Ubuntu
sudo /usr/sbin/vsftpd /etc/vsftpd.conf
相關內容
- 已提問 1 年前
