Sshpass is a tool for non-interactivly performing password authentication with SSH's so called "interactive keyboard password authentication". Most user should use SSH's more secure public key authentiaction instead.
Questions tagged [sshpass]
22 questions
4
votes
2 answers
Nested sshpass for ssh with "-J" jump host option
I have a script with ssh commands that are using a jump host:
scp -J user@jump file admin@server
ssh -J user@jump admin@server "touch hello"
I would like to ask for the passwords only once and tried sshpass:
sshpass -p "PasswordForJump" scp -J…
gervais.b
- 141
- 1
- 3
3
votes
3 answers
Different sources.list entries between 18.04 server and 18.04.1 server ISOs
I've built 2 fresh VMs of Ubuntu server. One is from the 18.04.1 ISO and the other is from an older 18.04 ISO. The issue I'm having is that 'apt get install ansible' doesn't work on the 18.04.1 VM whereas it will work on the 18.04 VM. (I should…
Dax Mickelson
- 51
- 2
- 4
2
votes
1 answer
When does sshpass close a connection
I am using sshpass in a script which executes rsync and backup a file from remote server, I added that script to cron which runs every minute. Now I am concerned about the connections, does the connection remains opened? how shall I close the…
Aadam
- 123
- 4
2
votes
2 answers
sshpass broken since ubuntu 16.04
Since I upgraded to 16.04, the following command fails:
sshpass -p password ssh user@host
with the error:
Could not create directory '/home/mylocaluser/.ssh'.
(~/.ssh folder already exists).
The following command:
ssh user@host
still…
jasmines
- 10,643
- 16
- 84
- 108
2
votes
1 answer
script using rsync by SSH encounters 'Host key verification failed' but only when ran by systemd service
I am running an rsync script to copy files from a pi to local folder, the script works as intended when run manually but fails with:
: Host key verification failed.
: rsync error: unexplained error (code 255) at rsync.c(703) [Receiver=3.2.3]
When…
Shovel_jockey
- 41
- 3
2
votes
2 answers
How to trigger an alias over sshpass/ssh?
I have a server with an alias as follows:
~/.bash_aliases
alias update='sudo apt update && sudo apt -y upgrade'
Now I want to create a shortcut from my desktop that can simply trigger this script remotely over sshpass:
For a simple login, it works…
membersound
- 1,310
- 5
- 17
- 37
2
votes
3 answers
automate sshpass when server is asking a "yes/no" question
I have this small script for connecting to new machines I don't have ssh-key to:
function my_ssh () {
ip=$1
optional_cmd=$2
ssh -o "BatchMode yes" user_name@$ip exit > /dev/null 2>&1
if [ $? -gt 0 ]; then
echo "1st time…
CIsForCookies
- 1,089
- 11
- 30
1
vote
0 answers
sshpass I want to use in .sh and execute some commands Ubuntu 16.04
From one VM-X i want to log onto different VM-Y, get output dh -H command from VM-Y
and find out which disk usage is above say 50% and sendemail
from VM-X
echo "df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 \" \" \$1 }'" | sshpass…
ManojA
- 11
- 2
1
vote
1 answer
ssh with StrictHostKeyChecking
When I am connecting the other machine with ssh, every time I answered this question with yes/no -
user@computer$ ssh user@host
This host key is known by the following other names/addresses
~/.ssh/known_hosts:xx: [hashed name]
…
Vishak Raj
- 13
- 3
1
vote
1 answer
How to multiple sshconnection in same bash script via sshpass
I'm a bit beginner on linux.
Let's imagine a scenario like this.
I have 4 different linux machines and these 4 machines have different scripts.
From to an another machine, I want to connect to these 4 different machines in the same script and run…
eagerdev
- 11
- 2
1
vote
1 answer
How to use SSHPASS with rsync and SSH in an automated shell script?
I'm copying images from another PC every 3 hours. But recently I encountered an error.
When I try to ssh to that PC I get this:
Unable to negotiate with 192.xxx.xx.xx port 22: no matching key exchange method found. Their offer:…
Francis Kane
- 11
- 4
1
vote
1 answer
Prohibiting remote login on Ubuntu 18
I am trying to prevent remote access for my laptop.
I went into sshd_config to try and set it up. My IT guy recommended the following changes to accomplish this:
PermitRootLogin no
PubkeyAuthentication no
PasswordAuthentication no
However, when I…
Jay Boyle
- 21
- 7
1
vote
0 answers
How to keep sshpass process in the background?
sshpass -p '1234567*' ssh -L 1080:192.168.0.1:2222 admin@gateway.com -p 4422 -f -C -N
The above code works on macOS (creating a 1080 tunnel to 192.168.0.1:2222 via gateway.com:4422 with username admin and password 1234567*).\
It doesn't work on…
Aero Windwalker
- 918
- 1
- 12
- 20
1
vote
0 answers
Bash Script to take Back up of a switch's Config via sshpass, then send results with mutt (email)
for the past 2 days i was trying to get the results of a show run on my switch and send it to me via mail. i alrdy made a bash script for it but still i dunno what i'm doing wrong here and after fixing everything seems like my bash scripts has its…
Hamid
- 11
- 3
1
vote
0 answers
How to use sshpass to sftp upload file?
I have following :
$ cat upload.sh
sshpass -f ~/path_to_password/pass.txt sftp user@remote.location.net:/pools/path/ << EOF
put backup.tar
EOF
When i execute the upload.sh it shows nothing (file is not uploaded) and does not exit auto. How to…
user25165