There are 4 remote hosts that I have stored in an array. A ssh trust has been created from the local host to each of the remote hosts.
I am trying to ssh to each of the servers in a for loop as shown below.
test.sh is a file on the local server that I am running on the remote host after I ssh to the remote host. But it is terminating after the first iteration. If I use -n switch it prompts me for password in the second iteration.
I am able to iterate successfully through the array if I specify the commands as mentioned below.
However, if I try to add the commands in a separate file called test.sh and stream it to ssh as shown below, it exits after the first iteration. Pressing Ctrl-C manually triggers the next iteration.
I repeat: You cannot put double quotes inside double quotes that way.
This is wrong:
This would be more correct:
I just realized, however -- your test.sh probably uses the ${version} variable, which is why you are feeding it into sh, yes? You want it to carry over. But arguments to sh -s don't work that way, you don't get the names, just $1 $2 $3. Not to mention, you need -- if you want it to assume the following are arguments. Try this:
So I think you actually want:
...and your script should be using $1 and not ${version} .
I suspect you can omit the -tt completely, too. I see no commands in there that actually need a terminal, and throwing one into the mix when not needed seldom helps.
Last edited by Corona688; 09-12-2013 at 01:25 PM..
Hi,
I am trying to complete my bash script in order to find which SSH servers on LAN are still active with the ssh keys, but i am frozen at this step:
#!/bin/bash
# LAN SSH KEYS DISCOVERY SCRIPT
</etc/passwd \
grep /bin/bash |
cut -d: -f6 |
sudo xargs -i -- sh -c '
&& cat... (11 Replies)
Hi folks.
I'm pretty new to unix, while I'm learning a lot I'm finding bash scripting quite confusing. Im sure it's not really, my head just hasn't clicked with it.
Anyway, I need a script to loop the ip addresses stored in a file and run a "pgrep <process>" and return the pid or some... (2 Replies)
Hello,
I tried ssh in debug mode and below is the debug snippet.ssh to a host is not working from any of the hosts
No credentials cache found
debug1: Miscellaneous failure
No credentials cache found
debug1: Next authentication method: publickey
debug1: Offering RSA public key:... (7 Replies)
Hi all.
Im working in a telco Environment and recently setup a new server. The other servers are a combination of Solaris + Linux machines.
Using my new server , I can ping all other servers ( solaris + redhat linux )
but the issue lies where I try to ssh.
I can only successfully ssh linux... (3 Replies)
Hello All,
Maybe I'm Missing something here but I have NOOO idea what the heck is going on with this....?
I have a Variable that contains a PATTERN of what I'm considering "Illegal Characters". So what I'm doing is looping
through a string containing some of these "Illegal Characters". Now... (5 Replies)
Hi All,
Okay, I need help.
I need to ssh in to multiple linux servers execute certain commands and get them to email and print on the screen when the script is being executed.
So below is my script. Its not working :-(.
#!/bin/bash
#linux/UNIX box with ssh key based login... (7 Replies)
We have a number of linux clusters running Oracle. The clusters require that all member nodes have promptless/passwordless login through ssh (ie. the keys were created with null passphrases). We also have a management server that is not a member of any cluster but routinely connects to nodes of all... (3 Replies)
Hi all,
I have a script written successfully and tuned by our members, now I am trying to execute this script from a taxi server.
My aim is I want to connect to four servers via ssh where I want to ran a script or run some commands and write the output to a file in the Taxi server.
I... (12 Replies)