Automated logon within shell scripts


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Automated logon within shell scripts
# 1  
Old 10-06-2010
Automated logon within shell scripts

Hi All,

I have created a server health checkup for 22 diferent ips and want to run my script from a single host server -->conduct health chekup on various servers--> Capture the deviations--> Get back all the deviations to the host server where the script was initiated.

Ive checkd out ssh keygen but was not clear of the process and to my dismay i dont have the root password. Is it possible that i can generate the pass key without having root password or through any other process.

Please Help...........!!i am going beyond my deadlines
Thanxxx in advance.

Regards
G.C

Last edited by zaxxon; 10-06-2010 at 05:11 AM.. Reason: Users caps lock key seems to have been stuck when writing the subject - fixed that
# 2  
Old 10-06-2010
You can create keys for any user. But you will have to work with those users then. In other words: If root is needed, you will have to create and exchange keys for root and if it is possible to work with another user which exists an all machines, you can exchange their keys and work with this user/key.

Also please refrain to write your subject of a thread all in upper case letters next time in case you wanted to get more attention, thanks.

There is plenty of threads in this forum about using passwordless login with ssh and also on the web.
# 3  
Old 10-06-2010
commands not running after logon

Hi Pal,

I was able to do ssh with the help of public key fundamental , i tried it out on my script but the problem is that the script stops after logging to the server and does not run any commands .But when i exit from that server the command runs automatically after that. Have a look at the script and the output --

Code:
 
nssh# cat module.sh
sleep 1
ssh nsadm@10.49.10.7; ls -lrt

nssh# ./module.sh
Last login: Wed Oct  6 15:53:24 2010 from 10.49.10.4
nssh#
nssh# exit
exit
Connection to 10.49.10.7 closed.
total 48
-rw-r--r-- 1 nsadm nsadms  570 Sep 29 12:47 test.txt
-rw-r--r-- 1 nsadm nsadms 5924 Sep 30 10:38 out
-rw-r--r-- 1 nsadm nsadms 1118 Oct  5 11:26 id_dsa2.pub
-rw------- 1 nsadm nsadms 1264 Oct  5 11:26 id_dsa2
-rw-r--r-- 1 nsadm nsadms    6 Oct  5 12:03 LDAP.pwd
-rwxrwxrwx 1 nsadm nsadms  280 Oct  5 12:08 ss.sh
drwxr-xr-x 2 nsadm nsadms 4096 Oct  5 17:54 Logging
-rwxrwxrwx 1 nsadm nsadms 9038 Oct  5 17:55 gaurav.sh
-rwxrwxrwx 1 nsadm nsadms   40 Oct  6 15:53 module.sh

SmilieSmilieSmilie

Moderator's Comments:
Mod Comment Use code tags please.

Last edited by zaxxon; 10-06-2010 at 08:37 AM..
# 4  
Old 10-06-2010
Leave the semicolon out.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Try to learn automated shell script

Hi, i am new to shell script,i have a algorithm but i am not able to write script for this! we have to run one menu script for 100 times,in the first time we have to give options and after that execute. 1.enter option for write,in that we give address and data 2.enter the option for read,we... (1 Reply)
Discussion started by: y9ec629
1 Replies

2. Shell Programming and Scripting

Automated scp using shell & expect

Hi All, I have written a script to automate scp of files. Most of the times it works fine except few cases. I want your help and suggestions to fix these failures. I have used expect & shell to do the automated scp. Below is code $ cat scp.ksh #!/bin/ksh inputfile=$1 fdest_sid=$2... (8 Replies)
Discussion started by: veeresh_15
8 Replies

3. UNIX and Linux Applications

How to write automated interactive shell script?

Hello everyone, I just want to write a shell script for automatic feeding the username and password prompts when running my commands, I tried this one but it did not work. Please help me for any way out. #!/bin/bash #!/usr/bin/expect cd ~/workspace/mimosanetworks_mimosa-nms ls -ltr ... (5 Replies)
Discussion started by: sandy-sm
5 Replies

4. Shell Programming and Scripting

Help with Automated Shell Script

Hello, how can I write a shell script that looks in running processes and if there isn't a process name containing 91.34.124.35 then execute a file in a certain place. I know PHP, in PHP I could do a preg_match_all but I don't know how to do it in shell. (5 Replies)
Discussion started by: nottingham
5 Replies

5. Shell Programming and Scripting

Commands not running after automated logon

Hi Frnds, I was able to do passwordless ssh with the help of public key fundamental , i tried it out on my script but the problem is that the script stops after logging to the server and does not run any commands .But when i exit from that server the command runs automatically after that. Have a... (1 Reply)
Discussion started by: gemnian.g
1 Replies

6. Shell Programming and Scripting

How to automated the shell script

hye there... really need ur help... i have a file ./filename... then i want to make ./filename automatic run... for example: if someone send me a file using scp...then the ./filename will run automatically... did u guys get what i mean.... if not please ask me... cz i really need ur help... (29 Replies)
Discussion started by: annetote
29 Replies

7. Solaris

How to start in a bash shell everytime I logon to SunOS?

Hi I logon to sunos boxes at work that starts in a ksh shell. I would like to login to a bash shell whenever I logon to the sunos boxes instead of having to login and type bash . I tried editing the .profile and added SHELL= usr/bin/bash however when I login I am still in the ksh shell. I... (4 Replies)
Discussion started by: Esa
4 Replies

8. Shell Programming and Scripting

How to make interactive shell script a automated one?

Hi, I am new to shell scripting.I have written a very simple shell scipt that asks for the username and password on executing. i.e echo "Enter username :" read usrname; echol "Enter password :"; read passwd; echo usrname; echo passwd; but now I want to make it automatic , such... (2 Replies)
Discussion started by: bhaskar_m
2 Replies

9. Shell Programming and Scripting

Need automated shell script please

I'm totally new to shell scripting and I would like to ask your help 1.i want to have a .sh script where it runs opening 2 applications one after another 2.i have 2 applications in /applications/app1 /applications/app2 3. want this script to launch app1 for 20 seconds and get killed... (2 Replies)
Discussion started by: uneex
2 Replies

10. Shell Programming and Scripting

Need help for automated shell script

hi, I have a system with 3 O/S on it ( win 32, RHEL 4 32 & 64) I'm very new to shell scripting and I'm seeking for help in this matter.. I want to have an automated script on REDHAT that would run/open multiple applications one after other timed out at 20 seconds interval. Eg:... (4 Replies)
Discussion started by: uneex
4 Replies
Login or Register to Ask a Question