300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > linux ssh命令 带密码 [命令] Linux 命令 sshpass(密码非交互式 ssh)(转载)

linux ssh命令 带密码 [命令] Linux 命令 sshpass(密码非交互式 ssh)(转载)

时间:2024-06-01 07:53:24

相关推荐

linux ssh命令 带密码 [命令] Linux 命令 sshpass(密码非交互式 ssh)(转载)

sshpass的安装使用

1:sshpass下载与安装

yum安装:

yum install sshpass

若yum安装不上,则用下面方法

/projects/sshpass/files/

or

/s/1pLNxeLd

or

wget /projects/sshpass/files/latest/download -O sshpass.tar.gz

2:下载后,解压,安装

tar -zxvf sshpass-1.06.tar.gz

cd sshpass-1.06

./configure

make

make install

3:使用命令

sshpass -p 123456 scp /home/file.txt root@10.0.0.37:/home/copy

后面这个是 “Are you sure you want to continue connecting (yes/no)”使得这个自动接受,若不加,则成功不了

4:脚本

复制代码

#!/bin/bash

password=123456

user=root

ip=10.0.0.37

file=/home/file.txt

sshpass -p $password scp file $user@$ip:/home/copy/

————————————————

版权声明:本文为CSDN博主「totoroKing」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。

原文链接:/qq_30553235/article/details/78711491

注明:所有转载内容皆直接从被转载文章网页的标题和内容的文本中复制而来

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。