SFTP
Secure File Transfer Protocol 协议用于在系统之间安全的传输数据。
语法
sftp <username>@<remote hostname or IP address>
用法
sftp [email protected]
, Connect to SFTPget example.txt
, Download file. Syntax:get [-afpR] remote [local]
put example.txt
, Upload file. Syntax:put [-afpR] local [remote]
指令
?
/help
quit
,exit
,bye
, Quit sftp
指令 (remote)
cd <path>
, Change remote directory to 'path'pwd
, Remote working directoryls
, Display remote directory listingmkdir <path>
, Create remote directoryrm <path>
, Delete remote filermdir <path>
, Remove remote directoryrename oldpath newpath
, Rename remote filemget *.txt
, Download multiple filesreget [-fpR] remote [local]
, Resume download file
指令 (local)
lcd <path>
, Change local directory to 'path'lpwd
, Local working directorylls
, Display local directory listinglmkdir <path>
, Create local directorymput *.txt
, Upload multiple filesreput [-fpR] local [remote]
, Resume upload file
文件权限
传输文件遇到异常,尝试修改文件夹权限 (如 sudo chmod 600 <path>
)。
部分选项
-4, Forces sftp to use IPv4 addresses only.
-6, Forces sftp to use IPv6 addresses only.
-C, Compression enable.
-c cipher, Selects the cipher to use for encrypting the data transfers. This option is directly passed to ssh.
-f, Requests that files be flushed to disk immediately after transfer.
-i identity_file, Selects the file from which the identity (private key) for public key authentication is read.
-l limit, Limits the used bandwidth, specified in Kbit/s (限制带宽)
-p, Preserves modification times, access times, and file mode bits from the source file. (保留源文件中的修改时间、访问时间和文件模式位)
-P, port (指定端口)
-q, Quiet mode.
-R num_requests, Specify how many requests may be outstanding at any one time. Increasing this may slightly improve file transfer speed but will increase memory usage. The default is 64 outstanding requests.
-r, Recursively copy entire directories.
-v, Verbose mode. Causes sftp and ssh to print debugging messages about their progress. This is helpful in debugging connection, authentication, and configuration problems.