linux ssh命令 带密码,[命令] Linux 命令 sshpass(密码非交互式 ssh)(转载)
sshpass的安裝使用
1:sshpass下載與安裝
yum安裝:
yum install sshpass
若yum安裝不上,則用下面方法
https://sourceforge.net/projects/sshpass/files/
or
https://pan.baidu.com/s/1pLNxeLd
or
wget http://sourceforge.net/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/
————————————————
版權(quán)聲明:本文為CSDN博主「totoroKing」的原創(chuàng)文章,遵循 CC 4.0 BY-SA 版權(quán)協(xié)議,轉(zhuǎn)載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/qq_30553235/article/details/78711491
注明:所有轉(zhuǎn)載內(nèi)容皆直接從被轉(zhuǎn)載文章網(wǎng)頁的標題和內(nèi)容的文本中復制而來
總結(jié)
以上是生活随笔為你收集整理的linux ssh命令 带密码,[命令] Linux 命令 sshpass(密码非交互式 ssh)(转载)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: linux命令行参数含空格,linux-
- 下一篇: arm linux 内核启动,Linux