SFTP

SFTP简述

sftp(Secure File Transfer Protocol)是一种安全的文件传送协议,是ssh内含协议,也就是说只要sshd服务器启动了,sftp就可使用,不需要额外安装,它的默认端口和SSH一样为22。

sftp通过使用加密/解密技术来保障传输文件的安全性,因此sftp的传输效率比普通的FTP要低,但sftp的安全性要比ftp高,因此sftp通常用于报表、对账单等对安全性要求较高的场景。

用法

连接远程服务器:

sftp username@ip

回车之后输入服务器密码即可连接成功。

默认走22 端口, 如果不是要修改

sftp -oPort=60001 [email protected]

使用-o选项来指定端口号.

-oPort=远程端口号

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 [-afpR] remote [local]         Download 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 [-afpR] local [remote]         Upload file
pwd                                Display remote working directory
quit                               Quit sftp
reget [-fpR] remote [local]        Resume download file
rename oldpath newpath             Rename remote file
reput [-fpR] local [remote]        Resume upload 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
文章目录