Questions tagged [sshpass]

sshpass is the Non-interactive ssh password auth OpenSource project.

About

sshpass is a tool for non-interactively performing password authentication with SSH's so called "interactive keyboard password authentication". It allows supplying SSH password in command line, file, environment variable, etc.

Always be careful who can access the files where sshpass calls are stored. Most user should use SSH's more secure public key authentication instead.

Its source code can be downloaded from source forge.

Links

SourceForge

189 questions
2
votes
3 answers

Activating conda environment from bash script

I would like to change my conda environment from a bash script. I want to run bash script_yxz, where 'script_xyz' is like: #!/bin/bash conda activate my_env and switch to my_env. This already works if I run source script_yxz. But I have the…
Pezz
  • 51
  • 1
  • 6
2
votes
1 answer

Rsync with sshpass on Linux using systemd: 'Host key verification failed.'

I am trying to set up rsync with sshpass on a RaspberryPi to connect to a Synology drive in order to synchronize data. The listed command: sshpass -p 'password' rsync -avz -e 'ssh -p 22' \home\pi host@IP::home/example works out fine, if I run it…
Kilian
  • 53
  • 5
2
votes
1 answer

How to properly iterate through a list using sshpass with a single ssh-login

Situation: we're feeding a list of filenames to an sshpass and it iterates correctly through a remote folder to check whether files with the given names actually exists, then build an updated list containing only the files that do exist, which is…
versvs
  • 643
  • 2
  • 12
  • 30
2
votes
0 answers

Ansible SSH error: Failed to connect to the host via ssh: ssh: connect to host 10.10.201.1 port 22: Connection refused

I have an Ansible server that I use to deploy a virtual machine on my VMware datacenter. Once the VM deployed, Ansible has to connect to VM for adding the sources list and install applications. However, 9 times out of 10 ansible does not connect to…
sdouilliet
  • 21
  • 1
  • 4
2
votes
2 answers

Python SSH iteration through different paths

I've got a JSON object which looks like this: {UID_1:{ jumpboxes:[jump_ip1, jump_ip2,...], hosts: [host_ip1, host_ip2,...], ...}, UID_2:{... The authentication to the jumpboxes is via kerberos (passwordless), the authentication to the…
vlex
  • 131
  • 12
2
votes
2 answers

How to avoid typing passphrase for public key when using ssh

If I want to use password, I can do it by: `sshpass -f <(printf '%s\n' your_password) ssh user@hostname` But sshpass seems not working for public key. I tried the following command and it failed: `sshpass -f <(printf '%s\n' your_passphrase) ssh -o…
Harvett
  • 178
  • 2
  • 8
2
votes
0 answers

sshpass does not work at HPUX 11.31

Does anyone successfully run sshpass at HPUX 11.31 ? I’ve compiled sshpass 1.06 at HPUX 1131, but when I run it, I got errors. The command I run : sshpass -p Abcd1234 ssh -vvv nledfd02 date I am able to connect by entering a password. Thus, the…
Michael Li
  • 21
  • 2
2
votes
1 answer

linux sshpass not able to execute command remotely

I have remote red-hat 5.4 machine where I am able to execute sudo lvdisplay command locally using xyz user but while executing the same command remotely using xyz user through sshpass, I am getting the result as sudo: lvdisplay: command not…
Anil More
  • 39
  • 1
  • 1
  • 6
2
votes
2 answers

Linux - Bash to login to a machine and then become root

I am trying to login to Linux box with my regular user and then become root using a bash script. My user is in the sudoers file so it can become root. The normal process would be the following: $ssh regularuser@machine regularuser@machine's…
JustQn4
  • 439
  • 1
  • 6
  • 12
2
votes
1 answer

sshpass doesn't work with SSH ProxyCommand option

I am trying to automate SSH login for a SSH tunnel using a proxy: I do not want to use the ssh-copy-id solution sshpass works properly when I set the ssh tunnel without ProxyCommand option but it doesn't work with the option set (Write failed.…
2
votes
0 answers

sshpass - scp error - lost connection

Any idea why I'm getting this. I can successfully ping the server from my local machine. which sshpass is showing valid output and I'm using Cygwin64. $ sshpass -p loriK0ba scp SSUA-HG.war SSUA-RCd.war loki12:/tmp/ARUNKS lost connection To install…
AKS
  • 16,482
  • 43
  • 166
  • 258
2
votes
1 answer

Meteor project deployment and mup setup command give "sshpass required for password based authentication" error

I am trying to deploy a Meteor based project. I'm using nitrous.io, digital ocean for the server, and compose.io for MongoDB. I already wanted to finish my deployment and run the "mup setup" command and had got this message: Meteor Up: Production…
1
vote
1 answer

bash: single quotes disappear while appending text to a file

I am trying to append a multiline text containing some single quotes(') to a file which is present on a different machine and can be only accessed through a different user. Here is my code snippet: element_list=("element1" "element2") for element in…
Kalit Inani
  • 59
  • 1
  • 10
1
vote
1 answer

Passing gitlab variables in sshpass script

Is there a way to add gitlab variables to the command ? eg: variables: ARTIFACTORY_ADDRESS: "a.com" script: sshpass -p "password" ssh -o "StrictHostKeyChecking=no" user@SERVER 'echo $ARTIFACTORY_ADDRESS' Currently its not taking the value from the…
neel jain
  • 23
  • 7
1
vote
2 answers

SCP and sshpass - Can't copy from remote source to local destination using script on PIs - debian11

I am struggling to copy files from a remote source to my local destination I am using scp and I have tried adding sshpass to send the password I have a script that copies from my local source to a remote destination which works: sudo sshpass -p "pi"…
Yoric
  • 11
  • 2
1 2
3
12 13