Skip to main content

Questions tagged [sshpass]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
61 views

Use sshpass for SSHFS with a proxy jump

I want to automatically mount an SSHFS directory with a proxy jump. Initially, i mount my SSHFS like this : sshfs -o ProxyJump=user_jump@jump_host user_final@final_host:/ How can i mount my SSHFS ...
Zylar's user avatar
  • 1
0 votes
2 answers
411 views

E: Package 'sshpass' has no installation candidate(not able to install sshpass in linux)

sudo apt-get install sshpass Reading package lists... Done Building dependency tree... Done Reading state information... Done Package sshpass is not available, but is referred to by another package. ...
nikita's user avatar
  • 1
0 votes
2 answers
259 views

Running a while loop on remote server using heredoc

I am trying to run below script on remote machine, I am facing two issues here The while loop defined in here doc is running endless read enter key does not work on remote host Without the sshpass ...
A2K's user avatar
  • 3
0 votes
0 answers
329 views

Run a docker container in a new interactive terminal with sshpass!

I'm trying to run a Docker container in a new interactive terminal with sshpass. I've found that: gnome-terminal --tab -- sh -c \ "sshpass -p "password" ssh name@ip -t 'bash -ic docker ...
PiEmmeC's user avatar
0 votes
0 answers
903 views

sshpass No such file or directory

need add string to file on remote ssh server without prompting sudo password myuser=testuser $ sshpass -p "$mypass" ssh -t -o StrictHostKeycheking=no $myuser@$myhost "echo $mypass | ...
tuytuy20's user avatar
1 vote
2 answers
967 views

Using sshpass with rsync to accept a fingerprint

I'm using rsync to copy a file to a device: sshpass -p <password> rsync -avzP <file> <user>@<IP address>:<folder> This has worked fine in the past but I was trying to ...
parsley72's user avatar
  • 289
1 vote
1 answer
76 views

Saving the output of find to a variable in a remote server

# Declare the array declare -a LC_lines # Read the lines of the file into the array readarray -t LC_lines < unique_running_jobs_directory.log sshpass -p password ssh -n [email protected] ...
Adupa Vasista's user avatar
0 votes
1 answer
712 views

How to download root user owned files via scp or rsync as a sudo user?

How to download the file which requires root permission from a remote server (via scp or rsync) as a sudo-user (non-interactive way)? Note that this sudo-user is not configured to not require the ...
MagePsycho's user avatar
-1 votes
1 answer
2k views

Non-interactive way to connect via SSH (possible options)

I am trying to create a generic bash script to connect to the remote server via SSH using a non-interactive approach (using sshpass). All I need to know is the possible way to connect via SSH. So far, ...
MagePsycho's user avatar
1 vote
2 answers
3k views

Rocky 8.5 - Alternate repo for sshpass, removed from EPEL

BACKGROUND: I am developing a Kickstart file to install Rocky (8.5), and I have included EPEL as a repo in order to install Ansible. Yesterday, when trying to install from my Kickstart file, I ...
afosbenner's user avatar
4 votes
1 answer
9k views

"ssh" works but "sshpass" doesn't - how is this possible?

I configured key pairs for SSH connection. It works but of course asks for the passphrase. ssh [email protected] So now I try to login with sshpass which I have installed. I tried with -p property ...
AndreyS's user avatar
  • 258
3 votes
2 answers
1k views

Using sshpass in Cygwin, ssh stills prompts for password

According to this RedHat SSH password automation guide I'm following the Example 4: GPG one, and following the steps in that guide I create my pass_file using my own passphrase. Then, I got this: gpg -...
Metafaniel's user avatar
0 votes
2 answers
1k views

sshpass splitting the password as two strings seperated by the character "&" in password

I have a password variable PASS whose value is abc123&zxcv456 When I try to do SSH in jenkins using the password variable like below sshpass -p ${PASS} ssh -o StrictHostKeyChecking=no admin@100....
light's user avatar
  • 11
3 votes
1 answer
3k views

SSH Tunnel with automatic reconnect and password auth in Docker container

I want to forward a Socks5 proxy using SSH with password authentication inside a Docker container. YES, I know that SSH keys would be better. But since it's not my own server, I'm not able to use keys,...
Lion's user avatar
  • 338
-1 votes
1 answer
964 views

sshpass with sftp not working from crontab?

I have a ssh script (for testing purpose) that I can run successfully from cmd: #!/bin/bash /usr/bin/sshpass -p 'password' /usr/bin/sftp user@host:/out/test/ <<< $'put -r /data/test/*' A ./...
membersound's user avatar
3 votes
1 answer
524 views

sshpass through regular ssh client

I am using an application that uses /usr/bin/ssh and requires passwordless authentication. Meanwhile I want to use this with a server that requires both publickey and password authentication at the ...
Wietse de Vries's user avatar
-1 votes
1 answer
783 views

Copying key to /root/.ssh/authorized_keys

I'm trying to copy a file (contains keys) to remote machine using below script. But the below error /root/.ssh/authorized_keys: Permission denied #!/bin/bash for i in `cat hosts` do cat team.keys | ...
user461370's user avatar
1 vote
1 answer
450 views

In Shell Script SSH connection is working only for first line data in CSV file and command failing for remaining servers

My target is to just validate the login is successful for list of servers in CSV file. For SSH Password, Userid and IP address, I am passing these values via CSV. And want to capture the result of SSH ...
Abhay Vaya's user avatar
1 vote
2 answers
472 views

sshpass Solaris one liner passing a command

I am trying to pass one liner sshpass command to Solaris box but won't work. those are the options I tried: sshpass -p "passw" ssh "[email protected]" -o StrictHostKeyChecking=no `...
dwt.bar's user avatar
  • 145
1 vote
0 answers
988 views

Passing multiple passwords for SSHPASS in environment variables

Hope everyone is safe and healthy. I am facing an issue in introducing multiple SSHPASS passwords in environment variables (/etc/profiles) I am trying to SSH (using SSHPASS) to two different servers ...
Manu's user avatar
  • 11
0 votes
2 answers
320 views

Login to ssh session and afterwards automatically look for and access existing screen session?

I would like to connect to a server using ssh and after logging in I would like to automatically execute screen -R My script looks as follows: sshpass -p password ssh -t [email protected] 'screen -R;...
baxbear's user avatar
  • 191
1 vote
1 answer
337 views

zsh completion for sshpass

I am using sshpass command like this: sshpass -p 'my_password' ssh user@server The full syntax, according to the man page is sshpass [-ffilename|-dnum|-ppassword|-e] [options] command arguments At ...
Martin Vegter's user avatar
3 votes
2 answers
5k views

sshpass with ssh -J jump host

I have a script with a couple of ssh commands that use a jump host. I would like to enter the jump and target server passwords each time and tried to use sshpass sadly "nesting" sshpass does ...
gervais.b's user avatar
  • 183
0 votes
1 answer
427 views

How can I run sshpass command with the remote environment, taking the source ~/.bashrc effect

For example, I run a command: sshpass -p passwd ssh dennis@ip python xx.py But, in this way, this command is running without the environment variables, which is set in /home/dennis/.bashrc. e.g.: ...
DennisLi's user avatar
  • 111
1 vote
2 answers
10k views

sshpass alternative in linux shell/bash code

These are standard sshpass commands to read password from file or as argument. user@linux:~$ sshpass -f pwd.txt ssh admin@server admin@server:~$ user@linux:~$ sshpass -p P@55 ssh admin@server admin@...
user avatar
1 vote
1 answer
1k views

How to keep sshpass process in the background?

sshpass -p '1234567*' ssh -L 1080:192.168.0.1:2222 [email protected] -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 ...
Aero Wang's user avatar
  • 161
0 votes
0 answers
885 views

How to run script with nohup through sshpass

I want to pass a local script generated on the fly and it will trigger another script on my remote machine to running some commands for a long period of time. this is the command I have tried: cat &...
Tiger's user avatar
  • 347
1 vote
1 answer
3k views

Bash script exit on command failure (sshpass)

I need to perform an operation on a list of server, through SSH. I am using sshpass, and that operation might fail, however it's supposed to happen a few time, and the script should still continue. #...
user96649's user avatar
  • 211
3 votes
0 answers
2k views

sshpass doesn't work with some servers?

Using sshpass in bash script. I am connecting to the server, send the command df -h and save the output in a txt file. It works fine with about 10 servers. I found it doesn't work with some other ...
sover's user avatar
  • 31
-1 votes
1 answer
403 views

how to enable root ssh public key login with no root account and sshpass and sudo?

I have created an azure vm server which is ubuntu 1804 and I need to enable root ssh public key login with it. Azure do not want me to enable root ssh public key login when the server is created, so I ...
bronze man's user avatar
0 votes
1 answer
972 views

Output remote hostname in sshpass session

I have created a shell script to connect to a list of servers using sshpass and run a list of about 30 commands. An extract of the script is below. The script will wget a new config file, but then I ...
Peter's user avatar
  • 3
0 votes
1 answer
795 views

brew is not found when I sshpass to the server

brew is installed on the server but when I sshpass to the server, it throws bash: brew: command not found and same is happening for ideviceinstaller bash: ideviceinstaller: command not found This is ...
Ram's user avatar
  • 1
-1 votes
1 answer
289 views

plink from one server to another server sshpass

i am trying to run a command "df -kh" in linux server(192.168.82.11) from plink application via intermediate linux server(192.168.82.10) like below. But plink command not running, it hangs. As i dont ...
Anavarathan's user avatar
0 votes
1 answer
286 views

run command in script after an ssh

In my script I need to access a remote server using ssh. On the remote I want to gather some data from log files. I have my script set up and the code works, but my problem is when I run the script it ...
Owen's user avatar
  • 9
3 votes
1 answer
3k views

How to safely pass password to a remote server to execute sudo commands

I have a very long bash script, at the end of it is a command to execute sudo commands on a remote server: 10 hours of local processing … ssh user@ip "sudo ls" I have set up ssh keys to connect to ...
Sulli's user avatar
  • 141
2 votes
1 answer
2k views

Stop CTRL+C Exiting Local Script Which is Running tcpdump in Remote Machine

I have setup a simple script like the below: sshpass -p $password ssh -T $username@$ip_address -p 30007 <<- EOF > $save_file.pcap sh tcpdump -i eth5.1 -s 0 -n -v -U -w - EOF sed -i '...
Drew's user avatar
  • 23
0 votes
1 answer
2k views

How to Pass Multiple Commands to Remote Device via SSHPass [duplicate]

I'm trying to setup a method in which I can run remote tcpdumps on some of my devices, and save the file to my local machine for analysis (I don't want to save the file on the remote device and then ...
Drew's user avatar
  • 23
2 votes
1 answer
2k views

sshpass in .ssh/config?

When running the command: ssh minix.p what I really want run is: sshpass -f ~/.ssh/minix-password ssh minix.p Is there any way I can do that? Background I want to use sshfs and similar tools, so ...
Ole Tange's user avatar
  • 35.8k
0 votes
1 answer
592 views

Executables specified with absolute path not found when using sshpass

Try as I might, I am unable to execute the lpstat and lp commands of CUPS remotely using sshpass in my script. I am able to execute all of the lines involving these commands when using an interactive ...
marktimsmith's user avatar
6 votes
2 answers
28k views

Multiple commands in sshpass [closed]

Is there a way to use the multiple commands in sshpass, I tried with difference combinations but it throws error. $ sudo sshpass -p $password ssh -t -oStrictHostKeyChecking=no $username@$ipaddress &...
Harry's user avatar
  • 201
2 votes
0 answers
333 views

Can't set title with gnome-terminal [duplicate]

I'm using Centos 7. When I sshpass to my remote login server, I need to specify the title to every terminal I open through gnome-terminal. I tried following approach from the link suggested by @...
MayankD's user avatar
  • 43
1 vote
2 answers
4k views

SSH remote - display echo on local terminal

The following is a part of my script where I want to echo some text to the local terminal if the condition fails in ssh. /usr/bin/sshpass -p $PASSWORD /usr/bin/ssh -t -o "StrictHostKeyChecking no" ...
Siva's user avatar
  • 9,077
0 votes
1 answer
507 views

unix throws error "sh: mntroot: not found" when doing sshpass with @host command, how to solve this?

My requirement : i want to pass some commands with sshpass command. ex 1: sshpass -p 'sshpass' ssh -oKexAlgorithms******* user@host touch /mnt/us/pass above sshpass example works perfectly. ex 2: ...
Santhosh's user avatar
  • 143
1 vote
1 answer
229 views

Tracking child processes sequentially

I'm running few commands on a remote server, by sshpass. gnome-terminal --maximize --tab --title='aTask' -e "sshpass -p "afsd@#$5u89f" ssh [email protected] 'command1 && command2'" \ ...
MayankD's user avatar
  • 43
5 votes
1 answer
8k views

Execute multiple command through SSH using sudo

#!/bin/bash while IFS="," read -r f1 f2 do username="testuser" SSHPASS='abcde' sshpass -e ssh -t "$username@$f1" "sudo su - root -c 'yum -y install wget'"< /dev/null ; done < Input.txt Now ...
Anna's user avatar
  • 51
1 vote
1 answer
4k views

Mount sshfs as non-root hangs forever

I made a sshfs mount point in my fstab, using sshpass to send the password (I need to do this because key authentification is not available on the remote server). Mounting the folder logged as root ...
Worst's user avatar
  • 41
5 votes
2 answers
15k views

sshpass not functioning in alpine linux

When I install sshpass on alpine linux it will install and the doc will show up if you run it without arguments, but using any argument (valid or invalid) returns sshpass: Failed to run command: No ...
Brian's user avatar
  • 291
-1 votes
1 answer
1k views

SSHPASS rsync scp -r copying few files worked later not working

rsync: link_stat "/home/user/file.txt" failed: No such file or directory (2) sshpass -e ssh -oBatchMode=no $user@$ip.$remotehost "rsync -v -e ssh file.txt /home/user/$folder/ && cd /home/user/...
bioinform's user avatar
1 vote
0 answers
812 views

Use sshpass to scp files from two remote hosts

I have the following problem. I have sshpass installed on Server A. I have files on Server B that I need to copy to Server C. (Servers B and C don't have sshpass installed, and are in another ...
tmorais's user avatar
  • 11
1 vote
0 answers
2k views

automount sshfs with autofs and sshpass

I want to mount partitions from a remote NAS that doesn't support login with a certificate. I created or edited the following files: /etc/ssh/sshpass.232 with ssh password /etc/ssh/sshpass.232.sh ...
igoryonya's user avatar
  • 163