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系统之间安全地进行文件共享。