ZKX's LAB

如何在shell脚本里使用sftp批量传送文件 sftp 脚本

2020-10-03知识7

linux系统中SFTP脚本如何添加打包tar命令 写tar的全路径

如何写一个shell脚本用sftp上传文件 主要步骤如下:1.为运行shell脚本的2113本地5261用户生成密钥对2.将其中的公钥分发4102到sftp欲登录的远程服务器上3.编写并以上面的本地1653用户运行shell脚本一.生成密钥对在shell脚本中使用sftp时必须用到密钥对(公钥和私钥).可使用下列方式生成(SSH 2.X版本),这里本地用户记为:local_user:ssh-keygen-dsa屏幕提示:Generating public/private dsa key pair.Enter file in which to save the key(/home/local_user/.ssh/id_dsa):按回车保存为:/home/local_user/.ssh/id_dsa,即当前用户local_user的私钥Enter passphrase(empty for no passphrase):按回车,表示读取密钥时不需要密钥的密码Enter same passphrase again:确认密钥的密码,必须和上面的输入相同Your identification has been saved in/home/local_user/.ssh/id_dsa.私钥保存信息Your public key has been saved in/home/local_user/.ssh/id_dsa.pub.公钥保存信息The key fingerprint is:ec:41:e8:08:38:0b:f8:1e:bc:92:98:32:fc:d7:69:7d.密钥指纹二.分发公钥为了使用密钥,必须将公钥分发到欲登录的远程服务器上,这里远程服务器记为remote_host,欲登录的远程用户记为remote_user1。.

如何在shell脚本里使用sftp批量传送文件 1.为运行shell脚本的本地用户生成密钥对,用于免密登录2.将其中的公钥分发到sftp欲登录的远程服务器上,实现免密登录的全信任3.编写shell脚本4.本地用户执行shell

如何实现shell脚本使用sftp的用户名密码自动连接,而不使用公钥。 是指特定shell在连线时侯,透过解开密码用户的用户解锁使用吗?不太懂是指放在ghost资料夹的shell资料夹,还是另外放的压缩档?或者是放在master夹内另外放的资料夹shell?

如何在shell脚本里使用sftp批量传送文件? 1、sftp属于交互式的,所以你得缓存下命令#。bin/shsftp-o Port=3322 root@172.16.1.21:/opt。mput*.log。2、用scp一行搞定scp-P3322/opt/*.txt root@172.16.1.22:/tmp3、用rsync同步整个目录 rsync-av '-e ssh-p 3322'/data/test root@172.16.1.23:/data

#shell#sftp命令#shell脚本#ftp

随机阅读

qrcode
访问手机版