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
4
votes
3 answers

Handling special characters in password field of sshpass

I have a Python script which uses sshpass for ssh access to a machine Popen(["sshpass","-p", "test!@#", "ssh", "-o UserKnownHostsFile=/dev/null", "-o StrictHostKeyChecking=no", "user1@192.168.10.1"]) But due to the presence of special characters in…
Manoj
  • 41
  • 1
  • 1
  • 2
4
votes
1 answer

Unable to run sshpass command in centOS

Have work on CentOS release 6.3 (Final) system. And try to ssh another machine using sshpass utility like sshpass -p 'password' ssh user@host But it give me error like sshpass: Failed to run command: No such file or directory So from error i think…
Jayesh Bhoi
  • 24,694
  • 15
  • 58
  • 73
3
votes
2 answers

How could I run a remote command within a Gitlab CI Pipeline using sshpass and print the output/depend on the result of that command?

I want to run a script that is on a separate server within a Gitlab CI job and have the job print the output of that script and depend on the script's result. I'm using sshpass to get around inputting a password like this: - sshpass -p "password"…
thebaconator
  • 223
  • 6
  • 10
3
votes
1 answer

GitLab CI: SSH fail, unable to authenticate private key

I followed this link to try to SSH to my server in Gitlab-CI. For the SSH keys, I went into the server, and generate the public & private keys. Private key is extracted into GitLab CI/CD env variables. YAML template is as below, copied mostly from…
Jake
  • 2,482
  • 7
  • 27
  • 51
3
votes
1 answer

Ansible : Must install the sshpass program

Ansible command: ansible all -m module-name -o -e "ansible_user=username ansible_password=password" Giving following error : host-ip | FAILED! => {"msg": "to use the 'ssh' connection type with passwords, you must install the sshpass program"} …
ross
  • 111
  • 1
  • 2
  • 9
3
votes
1 answer

PHP Output correct in terminal but not in browser

I just started working with shell_exec in php and stuck at this point. Below is my php script which runs in terminal correctly but not in browser. And output in terminal is $ php…
3
votes
1 answer

sshpass with proxycommand returns without running anything

In our environments, we have several servers in production. Every time I want to search for something, it may be in 1 of 4 different servers. I am creating a script to automate this search, so that I directly know which server is involved. I am…
jlengrand
  • 12,152
  • 14
  • 57
  • 87
3
votes
2 answers

How to sshpass ssh-copy-id?

I dont want to keep typing the passwords again and again, hence want to provide it into the command itself. How can I do it? Currently, I'm doing like this sshpass -p server_password port_number ssh-copy-id user@IP It says, sshpass: Failed to run…
Praful Bagai
  • 16,684
  • 50
  • 136
  • 267
2
votes
0 answers

Why does sshpass exist rather than an ssh option?

It seems odd to me that an entirely separate utility is needed to specify a password on an ssh connection. Why doesn't ssh have an option to supply the password non-interactively? The man page for sshpass says that it runs ssh in a dedicated tty…
vdbeek
  • 21
  • 1
2
votes
0 answers

Can I use sshpass in Windows?

I am trying to ssh to Linux without entering a password from Windows system. I have downloaded sshpass-1.08 and compiled it successfully. But when I tried to ssh to Linux with sshpass, I still had to enter a password.
2
votes
1 answer

Can't curl post with JSON to a remote machine: "was expecting double-quote to start field name"

I'm trying to post a trace to a remote machine by giving the trace path and name as parameters in the curl command like this: sshpass -p password ssh username@ip_adress "curl -X POST -d…
Abrahe
  • 21
  • 1
2
votes
2 answers

Shell script can read file line by line but not perform actions for each line

I'm trying to run this command over multiple machines sshpass -p 'nico' ssh -o 'StrictHostKeyChecking=no' nico@x.x.x.x "mkdir test" The IPs are stored in the following .txt file $ cat ips.txt 10.0.2.15 10.0.2.5 I created a bash script that reads…
2
votes
0 answers

sshpass: No such file or directory

Bellow command if i write inside a script (test.sh) and execute directly on the specific machine it works. sshpass -p $HOST_PWD sftp testuser@host <
R D
  • 1,330
  • 13
  • 30
2
votes
1 answer

How to use SSHPass with WSL to autostart & login a session

This might seem a little confusing, but I have a server I want to SSH into but the password is kinda long and complex, I understand for security I shouldn't save my password in plain text but for my convenience, I'm not too worried. Regardless, I'm…
2
votes
1 answer

How to make the ssh with -o StrictHostKeyChecking=no running on the docker in order to ssh the host work without exiting the script execution?

I have a script, that is running inside the docker container some actions we need for some internal debugging purposes: set -eu echo "Starting i/o test for host" IP_HOST=$(ip a | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b" | grep 172.17 | awk…
Eljah
  • 4,188
  • 4
  • 41
  • 85
1
2
3
12 13