LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 08-17-2012, 04:51 PM   #1
WimaxTech
LQ Newbie
 
Registered: Aug 2012
Posts: 4

Rep: Reputation: Disabled
SSH through SSH


I have inherited a test station at work that runs bash script. I am new to linux but have managed to get most of the software to work with this exception:

I am having a problem with the following line:

ssh -q -o "ConnectTimeout 10" root@$OSR_PC "sshpass -p default ssh -q -o \"ConnectTimeout 10\" root@$OSR_IP \"export lm_ctrl_channel_bw=$CHNL_BW; export lm_ctrl_dl_freq=$DL_CF; export lm_ctrl_afs=0; configdb -S lm_ctrl; reboot; exit\""

The test setup is as follows:

OBR_PC is linked to OSR_PC (address 172.18.0.20)
The OSR_PC is linked to OSR_IP(address: 169.254.101.2)

The software is to send the commands to the OSR_IP through the OSR_PC from the OBR_PC but I cannot get a link with this line and nether can my IT tech.
He wants to create an entire new configuration.
I can ssh into the OSR_PC and then ssh onto the OSR_IP.

Can I make the above script work without rewriting the entire program which is quite extensive?

Thanx in advance

WimaxTech

Last edited by WimaxTech; 08-17-2012 at 04:54 PM.
 
Old 08-17-2012, 04:58 PM   #2
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
Where is it failing?

I don't know about that command, but I can run
Code:
[user@comp1 ~]$ ssh comp2 "ssh comp3 ls"
and it successfully makes it through the chain and spits out the contents of comp3.
 
Old 08-17-2012, 05:10 PM   #3
WimaxTech
LQ Newbie
 
Registered: Aug 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
It appears fo fail after "sshpass -p default ssh -q -o \"ConnectTimeout 10\" root@$OSR_IP \"
There's a lot going on with this script that I do not know yet.
 
Old 08-17-2012, 07:13 PM   #4
zQUEz
Member
 
Registered: Jun 2007
Distribution: Fedora, RHEL, Centos
Posts: 294

Rep: Reputation: 54
If I were in your shoes, for the sake of testing where the failure is, I would take out the variables that reference known IP's, I would also setup ~/.ssh/config files on each machine that you are ssh'ing into to pre configure the "connecttimeout" options, and if possible I would even configure a passwordless ssh key for root@$OSR_IP to get rid of the "sshpass" command (BTW I had never heard of that till your post). That should leave you with a very minimalist command. Assuming that all works, you could back out of those changes to find the one that breaks.
 
Old 08-17-2012, 08:22 PM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Originally Posted by WimaxTech View Post
It appears fo fail after "sshpass -p default ssh -q -o \"ConnectTimeout 10\" root@$OSR_IP \"
There's a lot going on with this script that I do not know yet.
If you are a tester you should be aware of the fact that debug info
is crucial. Can you please tell us 'how" it fails, what output are
you getting?


Cheers,
Tink
 
1 members found this post helpful.
Old 08-18-2012, 12:48 PM   #6
WimaxTech
LQ Newbie
 
Registered: Aug 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
The software is setting frequency and bandwidth parameters on two systems to establish communication between the two.
The OBR unit, controlled from OBR_PC, is not a problem and works fine.
The software control of the OSR_IP does not report any error. The program continues to run but the parameters on OSR_IP are not changed. This results in a "Test Failure".
Entering the command line in Terminal,

ssh -q -o "ConnectTimeout 10" root@$OSR_PC "sshpass -p default ssh -q -o \"ConnectTimeout 10\" root@$OSR_IP"

I am unable to reach the command prompt of OSR_IP.
I have tried symplfing the line to : ssh root@$OSR_PC "sshpass -p default ssh root@$OSR_IP"
The return shows that the OSR_IP address has been added but nothing more happens.
I have been searching for a reason for this. As I have said earlier, I can ssh into OSR_PC and then ssh into OSR_IP and from what I know so far – this should work.
Is there a Good reference document that would help my understanding of using ssh in this manner?

Last edited by WimaxTech; 08-18-2012 at 12:49 PM.
 
Old 08-19-2012, 04:51 PM   #7
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Well ... I'd start hunting for sshpass; I've not come across that command in
over 15 years of using Linux. What does it do, where does it live?


Cheers,
Tink
 
Old 08-19-2012, 05:48 PM   #8
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,360

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
sshpass is not recommended for the reasons stated on the man page http://linux.die.net/man/1/sshpass.
I would indeed go with post#4; simplify the code (at least for debugging the issue) and use ssh auth-keys instead of sshpass.
 
Old 08-19-2012, 07:23 PM   #9
WimaxTech
LQ Newbie
 
Registered: Aug 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
sshpass is a utility designed for running ssh using the mode referred to as "keyboard-interactive" password authentication, but in non-interactive mode.

Security is a non-issue as the entire system on which it's run is closed and there can be no outside connections.
 
Old 08-19-2012, 07:42 PM   #10
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,360

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
I know what its used for; I read the page
Nonetheless, simplification would be better.
 
  


Reply



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
The difference in settings: console from desktop & ssh as DISPLAY not set when ssh in wikapuki Linux - Newbie 10 07-02-2010 09:44 AM
ssh-agent, ssh-add and ssh-keygen AND CVS raylpc Linux - General 2 11-19-2008 02:50 AM
LXer: ssh-xfer: Quickly grabbing files over an existing SSH connection LXer Syndicated Linux News 0 08-08-2008 03:11 PM
setting up an ssh soxy or local ssh tunnel from within an ssh soxy Mangenius Linux - Networking 0 03-05-2007 03:15 PM
Passwordless SSH with SSH commercial server and open ssh cereal83 Linux - General 7 04-18-2006 12:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:58 AM.

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
Open Source Consulting | Domain Registration