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
-1
votes
1 answer

sshpass remote command and switching user account in remote machine

The requirement is to do ssh to the remote machine and execute sudo su - "wasadmin/user" -c "whoami" to know whether the user1 have the sudo access to the particular application user on the remote machine. I tried with the following. But, something…
-1
votes
1 answer

how to supply multi-line commands to sshpass for a specific case using 'if-fi' in shell

sshpass -p "123456789" ssh -T jadams@192.168.1.85 <<'EOSSH' if [-d "$HOME/ajith/apache-tomcat-7.0.63/webapps/$tag_version" ] then sh $HOME/ajith/apache-tomcat-7.0.63/bin/shutdown.sh && rm -rf …
Ajith P
  • 21
  • 8
-2
votes
1 answer

Empty ssh invitation (no "user@host:~$") when run command after connect (sh script, sshpass)

Client OS: MacOS 12.1, Server OS: Linux Debian 9 (any server) case 1: #!/bin/bash sshpass -p mypass ssh user@host.ru -o StrictHostKeyChecking=no works fine: case 2: #!/bin/bash sshpass -p mypass ssh user@host.ru -o StrictHostKeyChecking=no "cd…
Anton
  • 59
  • 6
-2
votes
1 answer

PHP Script to copy database from one server to another

I have a scenario where I need to copy production database to my dev database on daily basis. Both are different servers. What I have thought of writing a cronjob that will do the stuff. I have written a php script. I am connecting to remote…
Awais Qarni
  • 17,492
  • 24
  • 75
  • 137
-2
votes
2 answers

How to pass a single quote through a double quoted echo command in a script to add a cron job

I have a script to update the cron job in a remote server accessed by ssh. I can't get the single quote to be put into the cron job from the echo command running in my bash script. This is the exact string I need in my cron job: 'bash -i >&…
C0ntr07
  • 51
  • 1
  • 1
  • 9
-2
votes
1 answer

When I try to run kubectl command through sshpass,it failed with Unable to connect to the server

I used such command: sshpass -p password ssh root@x.x.x.x 'date;kubectl get pod;date' I got: Wed Sep 20 14:39:19 CST 2017 Unable to connect to the server: EOF Wed Sep 20 14:39:20 CST 2017 How to fix this issue? All kubectl commands work well on…
Lior
  • 81
  • 1
  • 3
-2
votes
3 answers

sshpass append string to a remote file

I need to append a variable string, via SSHPASS (bash script), to an existing file placed in the Remote Machine. I tried echo "$test" | sshpass -p $pass $host 'cat >> /remote/full/path/log/report.log' sshpass -p $pass $host "echo $test" >>…
DanieleO
  • 462
  • 1
  • 7
  • 20
-2
votes
3 answers

Permission denied using ssh command in shell

I'm trying to execute this shell with command line host="192.168.X.XXX" user="USERNAME" pass="MYPASS" sshpass -p "$pass" scp -o StrictHostKeyChecking=no /home/MYPATH/File.import "$user@$host:/"home/MYPATH/ To copy a file from my local server in to…
Fabio
  • 85
  • 1
  • 2
  • 14
-3
votes
1 answer

Downloading file from SFTP location using public key

Previously I downloaded a CSV file from an SFTP server using SSHPASS where the authentication method was through username/password and not public key: sshpass -p [SFTP_SERVER_PASSWORD] sftp -o StrictHostKeyChecking=no -o HostKeyAlgorithms=+ssh-dss…
disasterkid
  • 6,948
  • 25
  • 94
  • 179
1 2 3
12
13