Secure File Transfer Protocol,安全文件传输协议。
相比 ftp 降低了速率,提升了安全性。
-
连接
默认端口为:22
sftp -oPort=1022 username@ip
-
常用命令
pwd
、ls
、cd
、mkdir
等命令类似于本地服务器的操作,关键是get
,put
两个命令
- 下载文件到本地服务器
get [-afPpRr] remote [local] # -r: 下载目录及以下文件
- 上传文件到远程服务器
put [-afPpRr] local [remote] # -r: 上传目录及以下文件
-
对本地服务器的操作
!cmd
: 命令前加!
对本地进行操作
lls
或!ls
: local ls
lpwd
或!pwd
: local pwd
-
退出远程服务器
bye
、exit
、quit
、^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
网友评论