SFTP(Secure File Transfer Protocol)是一種安全的文件傳輸協議,它通過SSH協議進行加密傳輸,確保數據在傳輸過程中的安全性。以下是使用SFTP進行文件共享的基本步驟:
在Linux上:
sudo apt update
sudo apt install openssh-server
sudo systemctl enable ssh
sudo systemctl start ssh
sudo systemctl status ssh
在Windows上: 可以使用第三方軟件如 OpenSSH for Windows 或 WinSCP。
/etc/ssh/sshd_config:sudo vim /etc/ssh/sshd_config
確保以下配置項設置正確:Port 22
PasswordAuthentication yes
重啟SSH服務以應用更改:sudo systemctl restart sshd
在Linux或Mac上: 打開終端,使用以下命令連接到SFTP服務器:
sftp user@hostname
輸入密碼進行身份驗證后,即可使用SFTP命令進行文件操作。
在Windows上: 使用圖形化SFTP客戶端如 FileZilla 或 WinSCP。輸入服務器的IP地址、用戶名、密碼,然后連接到SFTP服務器。
ls
put local-file [remote-file]
get remote-file [local-file]
mkdir [remote-directory]
rm [remote-file_or_directory]
通過以上步驟,您可以在Linux和Windows系統之間安全地進行文件共享。