LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 01-24-2011, 11:00 AM   #1
bridrod
Member
 
Registered: Aug 2009
Distribution: SLES, openSUSE
Posts: 39

Rep: Reputation: 15
Parallel multiple ssh tool pseudo tty support


Gents,

I use mpssh or pssh to issue commands to multiple servers. Problem is that some of the commands require pseudo terminal and won't work with these tools.

This will work just fine: "ssh -t user@server command" as stated under SSH man:

-t = Force pseudo-tty allocation. This can be used to execute arbitrary screen-based programs on a remote machine, which can be very useful, e.g., when implementing menu services. Multiple -t options force tty allocation, even if ssh has no local tty.

So, is there a workaround for the above tools? Or is there any other tool for multi server administration that will work? If you are not sure what I am talking about just try executing "ssh user@server top" and "ssh -t user@server top" to know exactly the difference.

Thanks,
Rod
 
Old 01-25-2011, 02:55 PM   #2
sys64738
Member
 
Registered: May 2008
Location: NRW/Germany
Posts: 105

Rep: Reputation: 30
Hi
I think the package pssh will help you.
Do
Code:
man parallel-ssh
which will give the following information:
Quote:
.
.
.
-O --options SSH options (OPTIONAL)
.
.
.
I don't have some ssh Servers to check it out, but I would do:
Code:
parallel-ssh --options -t -h host.txt top
Just check it out.
 
Old 01-25-2011, 04:17 PM   #3
bridrod
Member
 
Registered: Aug 2009
Distribution: SLES, openSUSE
Posts: 39

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by sys64738 View Post
Hi
I think the package pssh will help you.
Do
Code:
man parallel-ssh
which will give the following information:

I don't have some ssh Servers to check it out, but I would do:
Code:
parallel-ssh --options -t -h host.txt top
Just check it out.
That's not it. Those are different type. Thanks for trying anyway!
 
Old 01-25-2011, 08:09 PM   #4
sys64738
Member
 
Registered: May 2008
Location: NRW/Germany
Posts: 105

Rep: Reputation: 30
Are you talking about this:

http://www.theether.org/pssh/
?
Well then have a look at this:
http://www.theether.org/pssh/docs/0.2.3/pssh-HOWTO.pdf
Page 2 says pssh has the option too.
 
Old 01-25-2011, 08:50 PM   #5
bridrod
Member
 
Registered: Aug 2009
Distribution: SLES, openSUSE
Posts: 39

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by sys64738 View Post
Are you talking about this:

http://www.theether.org/pssh/
?
Well then have a look at this:
http://www.theether.org/pssh/docs/0.2.3/pssh-HOWTO.pdf
Page 2 says pssh has the option too.
The "options" are SSH configuration options and not command options like the "-t" to allow pseudo-terminal. So, both parallel ssh implementations will pass the -o option for this (taken from man ssh):

-o option
Can be used to give options in the format used in the configuration file. This is useful for specifying options for which there is no separate command-line flag. For full details of the options listed below, and their possible values, see ssh_config(5).

AddressFamily
BatchMode
BindAddress
ChallengeResponseAuthentication
CheckHostIP
Cipher
Ciphers
ClearAllForwardings
Compression
CompressionLevel
ConnectionAttempts
ConnectTimeout
ControlMaster
ControlPath
DynamicForward
EscapeChar
ExitOnForwardFailure
ForwardAgent
ForwardX11
ForwardX11Trusted
GatewayPorts
GlobalKnownHostsFile
GSSAPIAuthentication
GSSAPIDelegateCredentials
HashKnownHosts
Host
HostbasedAuthentication
HostKeyAlgorithms
HostKeyAlias
HostName
IdentityFile
IdentitiesOnly
KbdInteractiveDevices
LocalCommand
LocalForward
LogLevel
MACs
NoHostAuthenticationForLocalhost
NumberOfPasswordPrompts
PasswordAuthentication
PermitLocalCommand
Port
PreferredAuthentications
Protocol
ProxyCommand
PubkeyAuthentication
RekeyLimit
RemoteForward
RhostsRSAAuthentication
RSAAuthentication
SendEnv
ServerAliveInterval
ServerAliveCountMax
SmartcardDevice
StrictHostKeyChecking
TCPKeepAlive
Tunnel
TunnelDevice
UsePrivilegedPort
User
UserKnownHostsFile
VerifyHostKeyDNS
VisualHostKey
XAuthLocation

Unless pseudo terminal support is one of the options above. The "-t" I need can be found with this information (outside of the "-o" option):

-t Force pseudo-tty allocation. This can be used to execute arbitrary screen-based programs on a remote machine, which can be very useful, e.g. when implementing menu services. Multiple -t options force tty allocation, even if ssh has no local tty.
 
Old 01-26-2011, 04:02 AM   #6
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,339

Rep: Reputation: 260Reputation: 260Reputation: 260
I never used pssh, but it looks like a plain Python script, in which you can edit the call to ssh in certain lines to add -t. As it's just calling ssh without a full pathname, also an ssh-wrapper could help to customize its behavior.
 
Old 01-26-2011, 10:10 AM   #7
bridrod
Member
 
Registered: Aug 2009
Distribution: SLES, openSUSE
Posts: 39

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Reuti View Post
I never used pssh, but it looks like a plain Python script, in which you can edit the call to ssh in certain lines to add -t. As it's just calling ssh without a full pathname, also an ssh-wrapper could help to customize its behavior.
Thanks for the hint, but I don't want to reinvent the wheel. Besides, my programming skills are very limited. Hopefully soon one of the programmers for mpssh or pssh will implement this.

I even tried cssh but I don't like to open hundreds of little java-like screens on my WS, reason mpssh and pssh are more appealing (script based).
 
Old 01-26-2011, 10:26 AM   #8
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,339

Rep: Reputation: 260Reputation: 260Reputation: 260
This is a small operation. In pssh it's line 164 and 168 where -t can be added
Code:
cmd = "ssh -o \"%s\" %s -p %s -l %s %s \"%s\"" % \
to
Code:
cmd = "ssh -t -o \"%s\" %s -p %s -l %s %s \"%s\"" % \
Similar for line 168. When I read the docs in the right way, it might be necessary to specify -t twice in both cases.
 
Old 01-26-2011, 02:49 PM   #9
bridrod
Member
 
Registered: Aug 2009
Distribution: SLES, openSUSE
Posts: 39

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Reuti View Post
This is a small operation. In pssh it's line 164 and 168 where -t can be added
Code:
cmd = "ssh -o \"%s\" %s -p %s -l %s %s \"%s\"" % \
to
Code:
cmd = "ssh -t -o \"%s\" %s -p %s -l %s %s \"%s\"" % \
Similar for line 168. When I read the docs in the right way, it might be necessary to specify -t twice in both cases.
Seems like the version I got does not match your info. I got a later version from here (v2.2): http://linux.softpedia.com/get/Utili...ssh-8542.shtml

Can't locate that line. I edited trying to add the -t but I got a bunch of errors.
 
Old 01-26-2011, 03:10 PM   #10
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,339

Rep: Reputation: 260Reputation: 260Reputation: 260
Oh, I'm sorry. Do you have this in line 70:
Code:
        cmd = ['ssh', host, '-o', 'NumberOfPasswordPrompts=1',
then it should be:
Code:
        cmd = ['ssh', '-t', host, '-o', 'NumberOfPasswordPrompts=1',
 
Old 01-26-2011, 03:20 PM   #11
bridrod
Member
 
Registered: Aug 2009
Distribution: SLES, openSUSE
Posts: 39

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Reuti View Post
Oh, I'm sorry. Do you have this in line 70:
Code:
        cmd = ['ssh', host, '-o', 'NumberOfPasswordPrompts=1',
then it should be:
Code:
        cmd = ['ssh', '-t', host, '-o', 'NumberOfPasswordPrompts=1',
Yeah, that's what I tried before. I also tried 'ssh -t' with same results... I get this:

[1] 16:19:35 [FAILURE] LAB-LINUX1 Exited with error code 1
 
Old 01-26-2011, 03:26 PM   #12
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,339

Rep: Reputation: 260Reputation: 260Reputation: 260
For me it's working with a command like:
Code:
./pssh -h hosts.txt ls ">>" foobar
Is it giving the error only with your application or also with such a simple command?

Edit: you can also try to enter -t twice.
 
Old 01-26-2011, 03:40 PM   #13
bridrod
Member
 
Registered: Aug 2009
Distribution: SLES, openSUSE
Posts: 39

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Reuti View Post
For me it's working with a command like:
Code:
./pssh -h hosts.txt ls ">>" foobar
Is it giving the error only with your application or also with such a simple command?

Edit: you can also try to enter -t twice.
You are officially THE MAN!

My script is working now. I will do some more testing tomorrow but it's looking good! The double '-t' worked:

FROM:
Code:
        cmd = ['ssh', '-t', host, '-o', 'NumberOfPasswordPrompts=1',
TO:
Code:
        cmd = ['ssh', '-t', '-t', host, '-o', 'NumberOfPasswordPrompts=1',
 
Old 01-27-2011, 09:34 AM   #14
bridrod
Member
 
Registered: Aug 2009
Distribution: SLES, openSUSE
Posts: 39

Original Poster
Rep: Reputation: 15
Thumbs up

Well, I am happy with the current results, thanks to you. At least a couple of my scripts are working where they were not before.
 
  


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
What are pseudo-tty devices? pinga123 Linux - Newbie 2 09-21-2010 08:42 AM
Regarding Pseudo tty, Pseudo terminals ? mqureshi Programming 0 07-30-2005 10:51 AM
Pseudo tty configuration RH 7.3 Dalma Linux - Networking 1 06-17-2003 12:53 PM
Eterm pseudo-tty? jpbarto Linux From Scratch 4 04-14-2003 11:51 AM
Pseudo-TTY Control Under Linux nitr0gen Programming 0 03-21-2002 12:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:05 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
Open Source Consulting | Domain Registration