LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-03-2007, 02:01 AM   #1
venki
Member
 
Registered: Sep 2006
Location: India
Distribution: suse10.2
Posts: 128

Rep: Reputation: 15
Automatic ssh


Hi all,

there are 50 systems..with ips 192.162.1.1 to 50..

each has given in dns as a station..

i.e station1 to station50..

now i want a shell script for ssh...that is

whn i execute commad..directely it shld ask password for that station..

say 1.sh

then it shld ask enter ur station number ..then if i give sation number it shld ask for password..

plz help me
 
Old 02-03-2007, 03:04 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
Can you detail *why* you want this? it's probably a lot easier to work out how to achieve what you want if we know your end goal... from what you've explained, there seems to be nothing more than what ssh would directly give you anyway. i can't see anything "automatic" in this..

btw, should is spelt "should" not "shld", you aren't typing a txt msg...
 
Old 02-03-2007, 06:16 AM   #3
itz2000
Member
 
Registered: Jul 2005
Distribution: Fedora fc4, fc7, Mandrake 10.1, mandriva06, suse 9.1, Slackware 10.2, 11.0, 12.0,1,2 (Current)]
Posts: 732

Rep: Reputation: 30
Code:
#!/bin/bash
function usage()
{
	echo $0 " login_name number_of_ssh port";
        echo $0 " my_login 3 22 --> will connect to 192.168.1.3 in port 22 with login : my_login"
}
if [ $# -ne 3 ]; then
	usage;
	exit 1;
fi
mask=`echo "192.168.1"`;
ssh -l $1 -p $3 $mask.$2;
 
Old 02-03-2007, 12:09 PM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
well there was certainly no mention of port numbers anywhere in the question...
 
Old 02-03-2007, 12:59 PM   #5
itz2000
Member
 
Registered: Jul 2005
Distribution: Fedora fc4, fc7, Mandrake 10.1, mandriva06, suse 9.1, Slackware 10.2, 11.0, 12.0,1,2 (Current)]
Posts: 732

Rep: Reputation: 30
Quote:
Originally Posted by acid_kewpie
well there was certainly no mention of port numbers anywhere in the question...
yeah... but why not give him a choice .. I made it anyway so why not give him more power with this script?!
 
Old 02-03-2007, 02:23 PM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
i'm still lost as to how this is actively useful... you run "myscript 23" instead of "ssh station23" ?? how's that useful?
 
Old 02-03-2007, 03:02 PM   #7
itz2000
Member
 
Registered: Jul 2005
Distribution: Fedora fc4, fc7, Mandrake 10.1, mandriva06, suse 9.1, Slackware 10.2, 11.0, 12.0,1,2 (Current)]
Posts: 732

Rep: Reputation: 30
Quote:
Originally Posted by acid_kewpie
i'm still lost as to how this is actively useful... you run "myscript 23" instead of "ssh station23" ?? how's that useful?
yes... I didn't understand why he wanted this script either.... but that's what he asked for, that's what he got.
Code:
for i in $(seq 1 50); do
echo "./first_post_script_name $i 23" > $i.sh;
chmod +x $i.sh;
done
this is the rest of the script....

Last edited by itz2000; 02-03-2007 at 03:10 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
open-ssh vs. commercial ssh (tru64), public-key auth not possible? cf050 Linux - Networking 8 03-28-2012 12:15 PM
ssh-agent, ssh-add and ssh-keygen AND CVS raylpc Linux - General 2 11-19-2008 03:50 AM
Passwordless SSH with SSH commercial server and open ssh cereal83 Linux - General 7 04-18-2006 01:34 PM
Automatic SSH tunnel for laptop ming0 Linux - Networking 1 02-26-2005 01:00 AM
Automatic SSH Tunnels fearofcarpet Linux - Software 1 12-05-2003 12:36 AM


All times are GMT -5. The time now is 02:35 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration