美文网首页
工具 | sftp 的简单了解

工具 | sftp 的简单了解

作者: shwzhao | 来源:发表于2021-09-20 14:57 被阅读0次

Secure File Transfer Protocol,安全文件传输协议。
相比 ftp 降低了速率,提升了安全性。

  • 连接
    默认端口为:22
sftp -oPort=1022 username@ip
  • 常用命令
    pwdlscdmkdir等命令类似于本地服务器的操作,关键是getput两个命令
  • 下载文件到本地服务器
get [-afPpRr] remote [local] # -r: 下载目录及以下文件
  • 上传文件到远程服务器
put [-afPpRr] local [remote] # -r: 上传目录及以下文件
  • 对本地服务器的操作
    !cmd: 命令前加 ! 对本地进行操作
    lls!ls: local ls
    lpwd!pwd: local pwd
  • 退出远程服务器
    byeexitquit^D

附:所有命令

sftp> ?
Available commands:
bye                                Quit sftp
cd path                            Change remote directory to 'path'
chgrp [-h] grp path                Change group of file 'path' to 'grp'
chmod [-h] mode path               Change permissions of file 'path' to 'mode'
chown [-h] 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 help

相关文章

网友评论

      本文标题:工具 | sftp 的简单了解

      本文链接:https://www.haomeiwen.com/subject/nunmgltx.html