跳转到内容

向服务器上传文件

需要已有可用的 SSH 连接。

Terminal window
scp ./index.html your_user@203.0.113.10:~/index.html
scp -r ./site your_user@203.0.113.10:~/site

非默认端口使用大写 -P。图形化客户端选择 SFTP,并核对主机指纹。

在两端运行 sha256sum index.html 比较校验值。先上传到用户目录,再使用适当权限移动到网站目录,避免给整个目录开放写权限。