Marco Nie - sftp https://blog.niekun.net/tag/sftp/ 使用SFTP管理远程服务器文件 https://blog.niekun.net/archives/130.html 2019-03-20T14:34:00+08:00 SFTP, which stands for SSH File Transfer Protocol, or Secure File Transfer Protocol, is a separate protocol packaged with SSH that works in a similar way over a secure connection. The advantage is the ability to leverage a secure connection to transfer files and traverse the filesystem on both the local and remote system.https://www.digitalocean.com/community/tutorials/how-to-use-sftp-to-securely-transfer-files-with-a-remote-serverLoginSFTP直接可以使用SSH账户登录:sftp user@romoteIP sftp -oPort=custom_port ser@romoteIP 查看帮助:help 内容如下:chmod mode path Change permissions of file 'path' to 'mode' chown own path Change owner of file 'path' to 'own' df [-hi] [path] Display statistics for current directory or filesystem containing 'path' exit Quit sftp get [-afPpRr] remote [local] Download file reget [-fPpRr] remote [local] Resume download file reput [-fPpRr] [local] remote Resume upload file help Display this help text lcd path Change local directory to 'path' lls [ls-options [path]] Display local directory listing lmkdir path Create local directory ln [-s] oldpath newpath Link remote file (-s for symlink) lpwd Print local working directory ls [-1afhlnrSt] [path] Display remote directory listing lumask umask Set local umask to 'umask' mkdir path Create remote directory progress Toggle display of progress meter put [-afPpRr] local [remote] Upload file pwd Display remote working directory quit Quit sftp rename oldpath newpath Rename remote file rm path Delete remote file rmdir path Remove remote directory symlink oldpath newpath Symlink remote file version Show SFTP version !command Execute 'command' in local shell ! Escape to local shell ? Synonym for helpNavigating with SFTP查看远程当前目录:pwd 查看本地当前目录:lpwd 查看远程当前目录文件:ls 查看本地当前目录文件:lls 切换远程目录:cd 切换本地目录:lcd Transferring Files with SFTP下载远程文件到本地语法:get remoteFile.txt 重命名下载的文件:get remoteFile.txt localFile.txt 下载文件夹到本地:get -r someDirectory 下载文件夹到本地且保持文件夹权限属性:get -Pr someDirectory 上载本地文件到远程语法:put localFile.txt 其他语法和下载 get 基本相同。查看远程服务器可用容量:df -h 以上命令无法直接查看本地容量,可用 ! 来实现:! df -h使用 ! 后任何本地命令都可以使用了,要想切换回 sftp 模式,使用如下命令:exit 以上就是常用的 SFTP 用法。常用客户端FileZilla (corss platform)WinSCP (windows)