Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
01-24-2011, 11:00 AM
|
#1
|
Member
Registered: Aug 2009
Distribution: SLES, openSUSE
Posts: 39
Rep:
|
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
|
|
|
01-25-2011, 02:55 PM
|
#2
|
Member
Registered: May 2008
Location: NRW/Germany
Posts: 105
Rep:
|
Hi
I think the package pssh will help you.
Do
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. 
|
|
|
01-25-2011, 04:17 PM
|
#3
|
Member
Registered: Aug 2009
Distribution: SLES, openSUSE
Posts: 39
Original Poster
Rep:
|
Quote:
Originally Posted by sys64738
Hi
I think the package pssh will help you.
Do
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!
|
|
|
01-25-2011, 08:50 PM
|
#5
|
Member
Registered: Aug 2009
Distribution: SLES, openSUSE
Posts: 39
Original Poster
Rep:
|
Quote:
Originally Posted by sys64738
|
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.
|
|
|
01-26-2011, 04:02 AM
|
#6
|
Senior Member
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,339
|
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.
|
|
|
01-26-2011, 10:10 AM
|
#7
|
Member
Registered: Aug 2009
Distribution: SLES, openSUSE
Posts: 39
Original Poster
Rep:
|
Quote:
Originally Posted by Reuti
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).
|
|
|
01-26-2011, 10:26 AM
|
#8
|
Senior Member
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,339
|
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.
|
|
|
01-26-2011, 02:49 PM
|
#9
|
Member
Registered: Aug 2009
Distribution: SLES, openSUSE
Posts: 39
Original Poster
Rep:
|
Quote:
Originally Posted by Reuti
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.
|
|
|
01-26-2011, 03:10 PM
|
#10
|
Senior Member
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,339
|
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',
|
|
|
01-26-2011, 03:20 PM
|
#11
|
Member
Registered: Aug 2009
Distribution: SLES, openSUSE
Posts: 39
Original Poster
Rep:
|
Quote:
Originally Posted by Reuti
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
|
|
|
01-26-2011, 03:26 PM
|
#12
|
Senior Member
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,339
|
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.
|
|
|
01-26-2011, 03:40 PM
|
#13
|
Member
Registered: Aug 2009
Distribution: SLES, openSUSE
Posts: 39
Original Poster
Rep:
|
Quote:
Originally Posted by Reuti
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',
|
|
|
01-27-2011, 09:34 AM
|
#14
|
Member
Registered: Aug 2009
Distribution: SLES, openSUSE
Posts: 39
Original Poster
Rep:
|
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.
|
|
|
All times are GMT -5. The time now is 06:05 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|