connecting servers using SSH - help needed


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting connecting servers using SSH - help needed
# 1  
Old 08-11-2008
Lightbulb connecting servers using SSH - help needed

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 tried to write some script using some sample script but failed to succeed. Please help me.

Regards,
Senthil kumar AK
# 2  
Old 08-11-2008
What failed, the ssh authentication? Need more input - write or describe your errors please.
# 3  
Old 08-11-2008
Hi all,

I tired this with a script available in the froum and its work fine for me now. I have created a public key so that the server ssh without any password prompt.

But now there is only one issue which I think I need some help.

This is the script which I have written in the taxi server where form I am connecting

bash-2.05$ cat connect.sh
#!/usr/bin/sh

while read box
do
ssh -n $box -l mvelmu 'hostname ; ksh /axphome/mvelmu/count.ksh' >> machineaddress.txt
done < "output.txt"

but when I ran this above script its returning with the results in the output.txt, but in the console I am able to see some system generated messages, how to suppress that messages.

THIS SYSTEM IS RESTRICTED TO AUTHORIZED USERS AND BUSINESS PURPOSES
ONLY. INDIVIDUALS ATTEMPTING UNAUTHORIZED ACCESS AND NON-BUSINESS
UTILIZATION ARE LIABLE FOR DAMAGES INCLUDING THE VALUE OF DIVERTED
RESOURCES AND CRIMINAL PROSECUTION.

By continuing to login you agree to the above and accept responsibility
for all of your actions.

Repeating four times as I am connecting to four servers.

regards,
senthilkumar AK
# 4  
Old 08-11-2008
Hi Senthil,

You can comment those Messages in the ssh file by using

*****************
THIS SYSTEM IS ......

*****************

and use in you file as

ssh -n $box -l mvelmu 'hostname 2>&1 | grep -v '^*' ; ksh /axphome/mvelmu/count.ksh' >> machineaddress.txt

Thanks,
JeganR
# 5  
Old 08-11-2008
Hi Jegaraman,

I have tried this but i am getting following error.

for all of your actions.
THIS SYSTEM IS RESTRICTED TO AUTHORIZED USERS AND BUSINESS PURPOSES
ONLY. INDIVIDUALS ATTEMPTING UNAUTHORIZED ACCESS AND NON-BUSINESS
UTILIZATION ARE LIABLE FOR DAMAGES INCLUDING THE VALUE OF DIVERTED
RESOURCES AND CRIMINAL PROSECUTION.

By continuing to login you agree to the above and accept responsibility
for all of your actions.
Usage: grep [OPTION]... PATTERN [FILE]...
Usage: grep [OPTION]... PATTERN [FILE]...
Usage: grep [OPTION]... PATTERN [FILE]...
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.
# 6  
Old 08-11-2008
Hi Senthil,

Can u just comment out each of the message using * and grep -v '^*'

Just print ur script on the post and we shall see to it..


Rgds
JeganR
# 7  
Old 08-12-2008
Lightbulb

this is the earlier script

bash-2.05$ cat connect.sh
#!/usr/bin/sh
while read box
do
ssh -n $box -l mvelmu 'hostname; ksh /axphome/mvelmu/count.ksh' >> output.txt
done < "machineaddress.txt"

after changing with grep -v option

bash-2.05$ cat connect_new.sh

#!/usr/bin/sh
while read box
do
ssh -n $box -l mvelmu 'hostname 2>&1 | grep -v '^*' ; ksh /axphome/mvelmu/count.ksh' >> output.txt
done < "machineaddress.txt"
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find active SSH servers w/ ssh keys on LAN

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)
Discussion started by: syrius
11 Replies

2. Shell Programming and Scripting

Shell script for connecting multiple servers and then copying 30 days old files

Shell script for connecting multiple servers and then copying 30 days old files from those server . HI , I have 6 multiple servers pla1,pla2,pla3,pla4,pla5,pla6 1. These six servers have common shared mount point /var/share 2. Running script from /var/share to connect these servers.I... (1 Reply)
Discussion started by: rcroyal88
1 Replies

3. UNIX for Advanced & Expert Users

Connecting using ssh

We have 2 different servers say A and B and I want to check the log file of 2 servers simultaneously. If I am logged into server A how can I connect to server B. I have used ssh username@B.But it is asking password. How can I give the password on ssh. Or is there any other utility for... (2 Replies)
Discussion started by: jim john
2 Replies

4. Shell Programming and Scripting

connecting servers using shell script

Hi , I have three linux servers. I want to login from one server and check some status in the other server. How to connect other server from one server using shell script. Can anyone advice on this? Thanks, Chelladurai. (4 Replies)
Discussion started by: ckchelladurai
4 Replies

5. Solaris

Documentation on connecting EMC storage to Solaris servers

Hi Can anyone suggest me some documents for EMC clarion documents which I am going to use in the servers with solaris environments. (1 Reply)
Discussion started by: ningy
1 Replies

6. Solaris

Problem in connecting TCP services between 2 Solaris Servers

Hi, I have 3 solaris servers. Two servers of differnet network and one gateway. Server1 --> 192.168.0.1 --> Solaris 9 Server2 --> 10.27.40.2 --> Solaris 10 Server3 --> Iface1 --> 192.168.0.5 --> Solaris 10 --> Gateway Iface2 --> 10.27.40.5 Now I am able to ssh... (36 Replies)
Discussion started by: neel.gurjar
36 Replies

7. UNIX for Advanced & Expert Users

connecting servers

hi everyone i want to establish smtp connection between unix server and windows 2k3 mail server they are on one intranet. and unix server has ftp and telnet connection with the mail server. . (0 Replies)
Discussion started by: parmeet
0 Replies

8. UNIX for Dummies Questions & Answers

connecting servers

Please help me out i want to know how to send email from unix machine to any email-id. mail to be sent is web based mail. (1 Reply)
Discussion started by: parmeet
1 Replies

9. Shell Programming and Scripting

Connecting to remote servers

Please advise, The previous thread asked about the automated transfer of files between two servers. The question is - is there any way of encrypting the password within the script or is it a matter of setting the permissions settings on the script so that it can only be executed and possibly... (1 Reply)
Discussion started by: rdbooth
1 Replies

10. UNIX Desktop Questions & Answers

Newbie help needed connecting to Internet

I have an Ultra5 with 2.56 that is connected to a network. We don't use a proxy server on the network but access the internet directly through a gateway. How do I configure the Solaris box to see the internet? Opening the internet explorer and setting HTTP; FTP etc ports to the ip of the... (3 Replies)
Discussion started by: FattyLumpkin
3 Replies
Login or Register to Ask a Question