Skip to main content

All Questions

Tagged with
0 votes
1 answer
52 views

Commenting out a line item in a text file that my bash .sh file refers to

I have an ssh .sh bash script file i'm running on a cron to check website status. The bash script (when ran) refers to a local txt file for a list of websites to check if they're down or up. ...
sven30's user avatar
  • 103
1 vote
2 answers
165 views

Multiple ssh sessions with different users

I am writing a script that connects to multiple servers which uses 3 different users. #!/bin/ksh server1=("abc1" "abc2") server2=("abc3" "abc4") server3=("...
NecroCoder's user avatar
0 votes
2 answers
60 views

Testing for dir via ssh script - nothing happens

I usually run server scripts like this, with a here-document. But when I test if a directory exists, the script continues even though the test fails -- why? ssh $user@$ip /bin/bash <<SCRIPT if [...
Vinn's user avatar
  • 216
4 votes
3 answers
552 views

Two ssh output as awk input

I have two remote servers that I am trying to ssh and cat some files.. I want to input the output of the ssh to a awk command. This is what I have got ssh username@host1 “cat /tmp/test/*” ssh ...
NecroCoder's user avatar
0 votes
0 answers
76 views

How do I make a .bashrc shell function interactive?

eshark() { ssh root@$1 'tcpdump -i $2 port 5060 -vv -s0 -Uw - ' | sudo tshark --interface - --print -w $3.pcapng } When I run this, on a Linux machine, it says capturing on stdin whereas when I run ...
David Conway's user avatar
0 votes
2 answers
226 views

How to execute local script (which executes another local script) in remote machine

I've written some script which looks like the following main.sh ls ./os.sh os.sh cat /etc/os-release executing like ssh user@serverA "bash -s" < ./main.sh "hi" "bye" ...
Md. A. Apu's user avatar
0 votes
0 answers
777 views

How to use heredoc inside my ssh command

I have a bash script that connects to a remote machine via SSH and runs a series of commands. It seems that the heredoc within the outer script is not aligning properly, and I keep getting an error. -...
George Udosen's user avatar
0 votes
1 answer
481 views

How to make a script to forward commands to an SSH server?

I have a remote SSH server with several custom utilities for my work. However, there are times when I feel lazy and don't want to start a full SSH session just to execute a single command. This ...
JM0's user avatar
  • 241
0 votes
0 answers
32 views

scp returns No such file or directory in script but executes when run manually [duplicate]

For context, I need to use a custom command to build an identity file so I can ssh successfully. I've renamed it because it's an internal tool and want to avoid NDA issues. You can consider it as a ...
HappyCoder's user avatar
-1 votes
1 answer
3k 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
0 votes
0 answers
172 views

Can't get list of files in directory in pam_exec.so script

I'm running a custom script on every ssh login to notify me if there was an a login by an unknown IP address that has not been added to a custom whitelist. I'm using pam_exec.so to check for this ...
Hanimir's user avatar
0 votes
1 answer
697 views

ssh password prompt message not showing in bash script

I am checking ssh connection through bash script echo -e "Checking if you have setup a key for serve ssh connection ..." timeout 5s ssh uname@host 'exit' if [ $? -eq 0 ]; then echo -e &...
Jagdish Pandya's user avatar
0 votes
0 answers
1k views

Shell script to login to remote server and execute further commands

I am automating something with Shell Script. And as a part of this, I need shell script to ssh to a remote server, change the hostname of remote server, modify a folder name keeping its contents as it ...
serverstackqns's user avatar
6 votes
2 answers
4k views

How to get the PID of a program executed in a bash script with remote linux

I'm on a Mac computer accessing by ssh a linux machine to run simulations. I'm currently running multiple commands in parallel (I put them in background with &), when they finish I extract the ...
Bahamut's user avatar
  • 71
0 votes
2 answers
1k views

ssh to a remote server and run a set of commands

I have 3 commands that i need to run on a remote server. The 2 commands are simple version checks and 3rd command is basically a short program that checks version of my database. This is how it goes #!...
Aayush Jain's user avatar

15 30 50 per page
1
2 3 4 5
10