Multi server access through remote server using ssh


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Multi server access through remote server using ssh
# 1  
Old 09-26-2014
Multi server access through remote server using ssh

Team,

Presently I have 5 ip address kept in ip_abc1 file, for each of the ip address listed, i need to login on each ipaddress
one at a time and login as below for that specific ip address
Code:
ssh -p 8101 karaf@<ip.address_for the specific ip address as logged in>
password
 
features:list
osgi:list
shell:logout

In thisway i need to perform same steps for my other 4 ip address listed

Any suggession as i will be doing it from my remote jump boxes, to access these ip address.

I am trying to fit in the below code but not sure....

Code:
for ip_addr in $(cat ip_abc1);do
echo "###batch $ip_addr### begins"
ssh ${ip_addr} "bash -s" < input_file
echo "###batch $ip_addr### ends"
done

Regards
Whizkid

Last edited by Franklin52; 09-26-2014 at 12:47 PM.. Reason: Fixed code tags
# 2  
Old 09-26-2014
You can do something like this..
Code:
for ip_addr in $(cat ip_abc1); do
ssh ${ip_addr} <<EOD
<command>
<command>
EOD
done

This User Gave Thanks to blackrageous For This Post:
# 3  
Old 09-26-2014
Also, you don't cram passwords into ssh, you use ssh keys.
This User Gave Thanks to Corona688 For This Post:
# 4  
Old 09-27-2014
Hi blackrageous,

when i tried using your script provided by you.. as below

Code:
for ip_addr in $(cat ip_abc1); do
ssh ${ip_addr} <<EOD
ssh -p 8101 karaf@${ip_addr}
$pwd
features:list
EOD
done

It gives me the below error on my logs.

Code:
./<my_script>: line 26: karaf: command not found
Pseudo-terminal will not be allocated because stdin is not a terminal.

Pseudo-terminal will not be allocated because stdin is not a terminal.
Permission denied, please try again.
Permission denied, please try again.
Permission denied (password).
-bash: line 3: features:list: command not found

Note:Password is common on all the 5 ip address. it should auto input the password.

Kindly advise.

Hi Corona688,
Thanks for the auto-ssh password link.. between i have limited access to those hence i am unable to make any changes on those files mentioned..
The password here is generic for all the 5 ip address.

Last edited by Franklin52; 09-27-2014 at 06:26 PM.. Reason: Fixed code tags
# 5  
Old 10-01-2014
Thanks a ton blackrageous & Corona688

It worked out.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Do I require remote login access to a windows server to transfer files from a UNIX server

Hi All I need to transfer a file from a UNIX server to a windows server. I saw that it is possible to do this using scp command by looking at the forum listed below: ... (2 Replies)
Discussion started by: vx04
2 Replies

2. IP Networking

Ssh to remote access point http server

I need to do some remote administration to an access point that is sitting behind a firewall that only has ssh enable from the outside but http/https from the inside. So to be a bit clearer: remote(outside firewall) ssh --> ssh-server(internal) --> access point(http/https) Ultimately... (3 Replies)
Discussion started by: metallica1973
3 Replies

3. UNIX for Advanced & Expert Users

Server access for SSH Tunneling!

Hi! I came to know about SSH Tunneling to bypass the Firewall. I will have to setup a free access SSH server to tunnel data access through PUTTY or OpenSSH. The problem is that I don't know about any free access servers. So, can anyone of you guide me for that, for any type of help? (1 Reply)
Discussion started by: nixhead
1 Replies

4. OS X (Apple)

Access the SSH of the server

Good evening I have a VPS Server Processor OS: centos-5-x86 I could not log on to the SSH Server This image from the panel WHM Main >> Server Status >> Service Status https://www.unix.com/attachment.php?attachmentid=1666&stc=1&d=1286598999 This copy of the program PuTTY ... (4 Replies)
Discussion started by: hamed
4 Replies

5. UNIX for Dummies Questions & Answers

server is up but cannot access through ssh

server is at remote site; server is up. I can access it through console. but I cannot access it through ssh. I have restarted SSH already and even do ifconfig ce0 down and up still not successful ... any comment? (2 Replies)
Discussion started by: uuontario
2 Replies

6. Shell Programming and Scripting

Can a script runned in local server access remote server?

Hi, Im creating a script that is supposed to run commands on remote server using sftp. My script is as below: #!/bin/ksh sftp remote_server mypassword cd /u08/mydir/allfiles mget * .. But this is what I got when I runned the script: Connecting to remote server...... (3 Replies)
Discussion started by: luna_soleil
3 Replies

7. UNIX for Dummies Questions & Answers

Remote Access to FTP server not working

I am trying to setup an FTP server in a Fedora Core 3 machine through the command line interface and not KDE. I think I am successful in getting the ftp service running, as when I do an ftp 127.0.0.1, I am able to log in using any one the user accounts I have created on this machine and browse... (8 Replies)
Discussion started by: cooljumbo2k8
8 Replies

8. UNIX for Dummies Questions & Answers

TomCat access in an Remote Linux Server

Hi all, I Installed Tomcat in an remote linux server (/usr/tomcat)and start service, using ./startup.sh (and tried with ./catalina.sh too). //----------------------------------------------------------------// # ./startup.sh Using CATALINA_BASE: /usr/tomcat/apache-tomcat-6.0.16/ Using... (1 Reply)
Discussion started by: gothama
1 Replies

9. UNIX for Advanced & Expert Users

remote web server access (apache)

Hi, I have web server (apache) installed in server-1 and i want to view the web pages from diferent servers also while the web server is running only in one server ....(all the servers are connected to office LAN) right now all the servers have apache running......and CPU utilzation is at its... (2 Replies)
Discussion started by: aditya.ece1985
2 Replies

10. Shell Programming and Scripting

remote server access

hi everybody, im kinda a new to scripting.... i have attached an image in this post... my goal is to extract data from the remote servers (server1,2,3 as in figure) to the server residing locally.... the criterias are: * I should not pass the password across the remote servers. *... (1 Reply)
Discussion started by: mercuryshipzz
1 Replies
Login or Register to Ask a Question