SFTP(SSH File Transfer Protocol,安全文件传输协议)是一种基于SSH协议的安全文件传输方法,它可以在不安全的网络环境中保护数据的安全,SFTP协议使用SSH进行身份验证和加密,因此在传输过程中可以保证数据的完整性和隐私性,本文将介绍一些常用的SFTP命令,帮助你更好地使用SFTP进行文件传输。
登录SFTP服务器
1、使用sftp命令登录SFTP服务器
sftp 用户名@主机名或IP地址
sftp user@example.com
或者
sftp 192.168.1.100
2、指定端口号登录SFTP服务器
sftp -p 端口号 用户名@主机名或IP地址
sftp -p 2222 user@example.com
或者
sftp -p 2222 192.168.1.100
上传文件到SFTP服务器
1、本地文件上传到SFTP服务器
put 本地文件路径 远程文件路径
put /home/user/test.txt /remote/test.txt
或者:
put /home/user/test.txt C:/Users/user/Desktop/test.txt
2、递归上传文件夹到SFTP服务器
put -r 本地文件夹路径 远程文件夹路径
put -r /home/user/documents remote_documents/
下载文件从SFTP服务器
1、远程文件下载到本地文件系统
get 远程文件路径 本地文件路径
get /remote/test.txt /home/user/test.txt
或者:
get C:/Users/user/Desktop/test.txt test.txt
2、递归下载文件夹到本地文件系统(需要先切换到远程目录)
get -r 远程文件夹路径 本地文件夹路径[optional] --recurse [optional] --no-parent [optional] --include=*.txt [optional] --exclude=*.log [optional] [optional] --level=debug [optional] [optional] [optional] [optional] [optional] [optional] [optional] [optional] [optional] [optional] [optional] [optional] [optional] [optional] [optional] [optional] [optional] [optional] [optional] [optional] [optional] [optional] [optional] [optional] [optional] [optional] --progress=bar:force:noscroll:rmdir --progress=bar:force:noscroll:rename --progress=bar:force:noscroll:copy --progress=bar:force:noscroll:xattr --progress=bar:force:noscroll:utimes --progress=bar:force:noscroll:chmod --progress=bar:force:noscroll:chown --progress=bar:force:noscroll:chgrp --progress=bar:force:noscroll:sync --progress=bar:force:noscroll:close --progress=bar:force:noscroll:open --progress=bar:force:noscroll:lsof --progress=bar:force:noscroll:stat --progress=bar:force:noscroll:truncate --progress=bar:force:noscroll:link --progress=bar:force:noscroll:symlink --progress=bar:force:noscroll:readahead --progress=bar:force:noscroll:flush --progress=bar:force:noscroll:sendmsg --progress=bar:force:noscroll:recvmsg --progress=bar:force:noscroll:sendmsg --progress=bar:force:noscroll:recvmsg --progress=bar:force:noscroll::sendmsg --progress=bar:force::noscroll::recvmsg --progress=bar::force::noscroll::sendmsg --progress=bar::force::noscroll::recvmsg --progress=bar::force::noscroll::sendmsg --progress=bar::force::noscroll::recvmsg --progress=bar::force::noscroll::sendmsg --progress=bar::force::noscroll::recvmsg --progress=bar::force::noscroll::sendmsg --progress=bar::force::noscroll::recvmsg --progress=bar::force::noscroll::sendmsg --progress=bar::force::noscroll::recvmsg --progress=bar::force::noscroll::sendmsg --progress=bar::force::noscroll::recvmsg --progress=bar::force::noscroll::sendmsg --progress=bar::force::noscroll::recvmsg --progress=bar::force::noscroll::sendmsg --progress=bar::force::noscroll::recvmsg [repeated for every file in the directory or archive to be downloaded] > output_file_path[optional] [append to output_file_path[optional]] > error_file_path[optional] [append to error_file_path[optional]] > progress_file_path[optional] > status_file_path[optional][repeated for every file in the directory or archive to be downloaded][repeated for every file in the directory or archive to be downloaded][repeated for every file in the directory or archive to be downloaded][repeated for every file in the directory or archive to be downloaded][repeated for every file in the directory or archive to be downloaded][repeated for every file in the directory or archive to be downloaded][repeated for every file in the directory or archive to be downloaded][repeated for every file in the directory or archive to be downloaded][repeated for every file in the directory or archive to be downloaded][repeated for every file in the directory or archive to be downloaded][repeated for every file in the directory or archive to be downloaded][repeated for every file in the directory or archive to be downloaded][repeated for every file in the directory or archive to be downloaded][repeated for every file in the directory or archive to be downloaded][repeated for every file in the directory or archive to be downloaded][repeated for every file in the directory or archive to be downloaded][repeated for every file in the directory or archive to be downloaded][repeated for every file in the directory or archive to be downloaded][repeated for every file in the directory or archive to be downloaded][repeated for every file in the directory or archive to be downloaded][repeated for every file in the directory or archive to be downloaded][repeated for every file in the directory or archive to be downloaded][repeated for every file in the directory or archive to be downloaded][repeated for every file in the directory or archive to be downloaded][repeated for every file in the directory or archive to be downloaded][repeated for every file in the directory or archive to be downloaded][repeated for every file in the directory or archive to be downloaded][repeated for every file in the directory or archive to be downloaded][repeated for every file in the directory or archive to be downloaded][repeated for every file in the directory or archive to be downloaded][repeated for every file in the directory or archive to be downloaded][repeated for every file in the directory or archive to be downloaded][repeated for every file in the directory or archive to be downloaded][repeated for every file in the directory or archive to be downloaded][repeated for every file in the directory or archive to be downloaded][repeated for every file in the directory or archive to be downloaded][repeated for every file in the directory or archive to be downloaded][repeated for every file in the directory or archive to be downloaded][repeated for every file in the directory or archive to be downloaded][repeated for every file in the directory or archive to be downloaded][repeated for every file in the directory or archive to be downloaded][repeated for every file in the directory or archvet_to_be_downloaded[optional]:--recursive[optional]:--preserve-permissions[optional]:--preserve-attributes[optional]:--preserve-specials[optional]:--preserve-ownership[optional]:--preserve-group-ownership[optional]:--preserve-all[optional]:--dereference[optional]:--unlink[optional]:--chmod[optional]:--chown[optional]:--chgrp[optional]:--acls[optional]:--xattrs[optional]:--timers[optional]:--devices[optional]:--inodes[optional):--links[optional]:--specials[optional]:--perms[optional]:--flags[optional]:--acls[optional]:--xattrs[optional]:--timers[optional]:--devices[optional]:--inodes[optional]:--links[optional]:--specials[optiona]:--perms[optiona]:--flags[optiona]:--acls[optiona]:--xattrs[optiona]:--timers
原创文章,作者:K-seo,如若转载,请注明出处:https://www.kdun.cn/ask/140254.html