Sponsored Content
Top Forums UNIX for Dummies Questions & Answers UNIX script to use ssh to host Post 302787843 by TripleHar on Sunday 31st of March 2013 05:13:09 AM
Old 03-31-2013
Lightbulb UNIX script to use ssh to host

I am doing an old-school command to get an inventory to many host using ssh thru Solaris machine. Please help me find a way thru script to get this automized. This will make me lazy but will surely benefit out of it. thanks in advance.

Process I am doing:

Host IPs (examples):
10.210.1.2
10.210.1.3
10.210.1.3
and maybe more

Command:
Code:
ssh -l SUPERUSER -p 1022 10.210.1.2

where:
Code:
     ssh -l SUPERUSER -p 1022 ==> fix command
     10.210.1.2                      ==> host

above command will ask for password as below maybe after 2 or 3 seconds depending on connection speed:
SUPERUSER@10.210.1.2's password:

password will be like
"secure"

I will then do a command like:
rtrv-alm-all;

then log-out to the host with the command:
logoff;

then, will proceed with the second host.

I will then save each output of each host to a file (1 text file per host).

Can you please help me get the proper script to get my work automized and appreciate some comments to help me understand how the script is being done.

I am thanking you guys in advance.

Moderator's Comments:
Mod Comment edit by bakunin: sigh..., wrong forum, missing CODE-tags. I do hope you script better than you post.

Last edited by bakunin; 03-31-2013 at 11:57 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

using: ssh host command

I will remote a connection to a Unix server and launch a command on this server. This commnand requires me to set a view in Clearcase to see the vob element. How do I set a view an run a command with ssh with the syntax: ssh host command? (3 Replies)
Discussion started by: majo
3 Replies

2. UNIX for Dummies Questions & Answers

host based ssh through a web browser

I'm looking for some sort of provider that I can connect to through a browser and subsequently open an ssh connection to another host. client based applet type solutions are blocked by firewall (2 Replies)
Discussion started by: dirtybrown
2 Replies

3. Shell Programming and Scripting

How can my unix shell script automatically connect to remote host?

How can my unix shell script automatically connect to remote host? Assume that there is a remote host called "rhost". When I connect to that host i give the command "telnet rhost". It then asks me for my id and password. Once i give it connects there. I want to automate these steps. I want... (8 Replies)
Discussion started by: digdarshan
8 Replies

4. Shell Programming and Scripting

ssh to a remote host

i want a script with expect or perl or shell which will do ssh to remote host...it will take commandline argument and run the script in remote host....... i.e that will be like ./ssh.exp remoteip username passwd /tmp.kk.sh can someone help me on this? (1 Reply)
Discussion started by: Aditya.Gurgaon
1 Replies

5. Solaris

unable to ssh to remote host

server is ok, I can login on console. however, when I use SSH teachia, there is no repsond. i have check ps-ef | grep ssh, it shows ok. restart ssh too. still not working. Anything else I need to check? # ps -ef | grep ssh root 24706 1 0 Jun 12 ? 0:00... (7 Replies)
Discussion started by: uuontario
7 Replies

6. Shell Programming and Scripting

ssh can't back from remote host during script execution

Hi all I wrote a script to execute a script on several remote hosts, but somehow during the execution of the local script, ssh can't come back from the remote host, so that causes my local script hanging... I use the below command to do the job in the local script, any idea? ssh... (12 Replies)
Discussion started by: bzylg
12 Replies

7. UNIX for Advanced & Expert Users

Help! How to find the local host after few ssh hops to remote host???

I do a ssh to remote host(A1) from local host(L1). I then ssh to another remote(A2) from A1. When I do a who -m from A2, I see the "connected from" as "A1". => who -m userid pts/2 2010-03-27 08:47 (A1) I want to identify who is the local host who initiated the connection to... (3 Replies)
Discussion started by: gomes1333
3 Replies

8. Shell Programming and Scripting

How to use ssh execute other shell script on other host (shell script include nohup)?

i want use ssh on the host01 to execute autoexec.sh on the host02 like following : host01> ssh host02 autoexec.sh autoexec.sh include nohup command like follwing : nohup /home/jack/deletedata.sh & after i execute ssh host02 autoexec.sh one the host01. i can't found deletedata.sh... (1 Reply)
Discussion started by: orablue
1 Replies

9. Shell Programming and Scripting

HTML Code to Run a Script from Remote Unix Host

Hi All, Noticed few posts around this but coudnt get exatcly what i wanted. Thanks for your help again. I have a script running on a remote machine and i normally ssh from putty and run the script manually. Is there anyway that i can write an HTML Code with a button so taht when I Click... (1 Reply)
Discussion started by: robinbannis
1 Replies

10. AIX

Ssh to the same host is not working

I am trying to ssh the same host where I am logged in.It's asking for the password. Please assist me with the troubleshooting steps for this. Best regards, Vishal (4 Replies)
Discussion started by: Vishal_dba
4 Replies
SSH-ARGV0(1)						    BSD General Commands Manual 					      SSH-ARGV0(1)

NAME
ssh-argv0 -- replaces the old ssh command-name as hostname handling SYNOPSIS
hostname | user@hostname [-l login_name] [command] hostname | user@hostname [-afgknqstvxACNTX1246] [-b bind_address] [-c cipher_spec] [-e escape_char] [-i identity_file] [-l login_name] [-m mac_spec] [-o option] [-p port] [-F configfile] [-L port:host:hostport] [-R port:host:hostport] [-D port] [command] DESCRIPTION
ssh-argv0 replaces the old ssh command-name as hostname handling. If you link to this script with a hostname then executing the link is equivalent to having executed ssh with that hostname as an argument. All other arguments are passed to ssh and will be processed normally. OPTIONS
See ssh(1). FILES
See ssh(1). AUTHORS
OpenSSH is a derivative of the original and free ssh 1.2.12 release by Tatu Ylonen. Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos, Theo de Raadt and Dug Song removed many bugs, re-added newer features and created OpenSSH. Markus Friedl contributed the support for SSH protocol versions 1.5 and 2.0. Jonathan Amery wrote this ssh-argv0 script and the associated documentation. SEE ALSO
ssh(1) Debian Project September 7, 2001 Debian Project
All times are GMT -4. The time now is 12:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy