How to setup SSH between 4 hosts ?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to setup SSH between 4 hosts ?
# 1  
Old 07-10-2006
Error How to setup SSH between 4 hosts ?

Hi,

I logged into h0011awe server. I am executing a script on this server which connects to other 3 hosts (h0022sam, h0033jar, h0044orc). In the script the command are like this
orapmon=`ssh $USR@$host ps -ef|grep -v grep|grep pmon`
I am using secured shell. How to setup that between these hosts which shouldn't ask me for passswords when i execute the script. My OS is Sun Solaris.

Thanks
# 2  
Old 07-10-2006
1. On the source server, run "ssh-keygen -t rsa" (for an RSA key; man ssh-keygen for alternate keys). Hit enter at each of the prompts. A file called "id_rsa.pub" will be located in your .ssh directory.

2. Copy the id_rsa.pub file to the three (or more) target servers and append it to the target server's authorized_keys file, located in the .ssh directory.

Note: This isn't ideal WRT security since if someone gains access to the source server, they then have access to all the others.

You can also use ssh-agent. I haven't used it so I can't be much help there. Man should work though Smilie

Carl
# 3  
Old 07-10-2006
One way (although not incredibly secure,) is:
Code:
host-a$ ssh-keygen -t dsa 
 (When prompted to enter a password, just type enter for a blank password.)
host-a$ cat ~/.ssh/id_dsa.pub |ssh host-b cat > ~/.ssh/authorized_keys2
 (Note: you will be prompted for a password here, but from now on, it should "trust" you.)
host-a$ ssh host-b ls -l
 (Assuming all went well, you should get the directory listing from host-b without being prompted for a password.)

Now, the above assumes some things, like you're using ssh2, your admin hasn't disabled you from doing that, that you are not breaking policy by doing that, etc.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Ssh to validate multiple remote hosts connection validation.

Dear Folks, I am trying to read a config file contains ip and port numbers. i want to read each line of the config file and check ssh connection is happening or not. Kindly guide. Config file: abc@1.2.342 22 abc@1.2.343 22 abc@1.2.344 22 abc@1.2.345 22... (9 Replies)
Discussion started by: sadique.manzar
9 Replies

2. UNIX for Dummies Questions & Answers

How to search using ssh on multiple hosts?

Hi guys - I am having a hard time trying to figure how to search for a certain string on config files hosted on multiple hosts. This is an example: Hostnames: myhost1.mycompany.com|myhost2.mycompany.com|myhost3.mycompany.com String to search for: myipaddress.somehost.com Directory... (9 Replies)
Discussion started by: DallasT
9 Replies

3. Red Hat

Force ssl/ssh to use the hosts file

does anyone know how to force ssh/ssl to use the hosts file instead of DNS? I have disabled the DNS servers but ssh still will not resolve a host in the hosts file. thanks in advance for the help! DS (3 Replies)
Discussion started by: derrell simpson
3 Replies

4. Shell Programming and Scripting

SSH to remote hosts in shell scripting

Hi There, I have a file contaning some 100 servers names one by one the file called redhat_servers.txt I want to prepare a script where it should give me the host name and kernal version. I wrote like this, #!/bin/bash while read line do ssh $line "uname -nr" done <... (3 Replies)
Discussion started by: kumar85shiv
3 Replies

5. Shell Programming and Scripting

Logon to multiple hosts using ssh hardcode password

Hi im trying to write a script to logon to list of servers with same userID. I have no option/plan to implement ssh-keygen sharing between the systems, so i have written script creating 2 files, file1 holds list of hosts host1 host2 host3 file2 has following script for i in `cat file1`... (1 Reply)
Discussion started by: dreamaix
1 Replies

6. Red Hat

apache httpd virtual hosts setup keep hitting the same VirtualHost

I'm trying to set up two virtual hosts. Here's my httpd config: <Directory /Users/userX/dev/sandbox-2> Order deny,allow deny from All Allow from localhost </Directory> NameVirtualHost 127.0.0.1 <VirtualHost 127.0.0.1> DocumentRoot "/Users/userX/dev/sandbox-2" ... (0 Replies)
Discussion started by: GlideK
0 Replies

7. UNIX for Advanced & Expert Users

how to check if I'm allowed to ssh several hosts.

Hi guys! I'm working on a little script. I have a txtfile with several hosts, Unix team has copied my keys into several of those servers, but not all of them, I need to figure out which ones I don't have access to, (I want a list of servers I don't have access to, so I can request for it). This... (1 Reply)
Discussion started by: erick_tuk
1 Replies

8. Red Hat

How to block ssh via /etc/hosts.deny

Hi.., I am using redhat5 server, i want to know the details about to block ssh via /etc/hosts.deny. Need help immediately (1 Reply)
Discussion started by: thakshina
1 Replies

9. Shell Programming and Scripting

Please advise on ssh to many hosts; su - and then commands

Hi, I would like to do ssh to many hosts and then would like to do 'su -' with respective host's passwords and execute certain commands. This being a secure and big network , we have to login every server individually and then su with different passwords. So is there a way to achive it? ... (2 Replies)
Discussion started by: newbewie
2 Replies

10. AIX

/etc/hosts via ssh

Hi, I want to change the /etc/hosts file on the hmc. I am connecting via ssh but any vi command is not allowed. Can someone please let me know how to do this? Many Thanks. Kees (23 Replies)
Discussion started by: KeesH
23 Replies
Login or Register to Ask a Question