Mailing List Archive

[Bug 984] Hangup to script while forced command ...
http://bugzilla.mindrot.org/show_bug.cgi?id=984

Summary: Hangup to script while forced command ...
Product: Portable OpenSSH
Version: 3.9p1
Platform: All
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: sshd
AssignedTo: openssh-bugs@mindrot.org
ReportedBy: webmyster@addoc.u-psud.fr


I have an account named demo. In its $(HOME)/.ssh/authorized_keys, I entered my
public key with a forced command that is a script. This script allows the user
to make a choice to launch a nohup backgrounded X-window (forked, without hang
up signal and without standard I/O). Then, the script leaves, that close the ssh
connection.
If I connect through ssh to this account without any command (ie : "ssh
user@computer"), xinit receives a hangup signal, causing X-window to shut down.
However, if i connect to this account with whatever string as command (ie : "ssh
user@computer foo"), my script is executed as expected : xinit don't receive any
hangup and X-window don't shutdown unless I do it explicitely.



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 984] Hangup to script while forced command ... [ In reply to ]
http://bugzilla.mindrot.org/show_bug.cgi?id=984





------- Additional Comments From djm@mindrot.org 2005-02-17 23:18 -------
Try setting setting no-pty on the key too. E.g.

no-pty,command="xscript" ssh-rsa ....

Does that help? HUP is only sent to shells with a controlling terminal



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 984] Hangup to script while forced command ... [ In reply to ]
http://bugzilla.mindrot.org/show_bug.cgi?id=984





------- Additional Comments From webmyster@addoc.u-psud.fr 2005-02-18 19:26 -------
(In reply to comment #1)
> Try setting setting no-pty on the key too. E.g.
>
> no-pty,command="xscript" ssh-rsa ....
>
> Does that help? HUP is only sent to shells with a controlling terminal

Actually no, because this script is asking the user through the read bash
command inside the script.
The most important problem, I think, is the strange behaviour that whenever I
specify one command (whatever command), it don't hang up my xinit. However, when
I don't give any command, a hangup is send to the xinit causing X-window to
shutdown.



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 984] Hangup to script while forced command ... [ In reply to ]
http://bugzilla.mindrot.org/show_bug.cgi?id=984





------- Additional Comments From dtucker@zip.com.au 2005-02-18 19:44 -------
(In reply to comment #2)
> > no-pty,command="xscript" ssh-rsa ....
>
> Actually no, because this script is asking the user through the read bash
> command inside the script.

Did you try it? "read" just reads from stdin and doesn't need a controlling
terminal.

> The most important problem, I think, is the strange behaviour that whenever I
> specify one command (whatever command), it don't hang up my xinit. However,
> when I don't give any command, a hangup is send

By default, when you "ssh yourserver" you get a pty and when you "ssh yourserver
somecommand" you don't. Try "ssh -T yourserver" to prevent allocation of a pty.

You could also launch the command in your script with nohup.



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 984] Hangup to script while forced command ... [ In reply to ]
http://bugzilla.mindrot.org/show_bug.cgi?id=984





------- Additional Comments From webmyster@addoc.u-psud.fr 2005-02-18 20:10 -------
Created an attachment (id=829)
--> (http://bugzilla.mindrot.org/attachment.cgi?id=829&action=view)
script running as forced-command

Here is the script I am running as forced-command. As you can see, there is
already nohup to launch commands.
The problem when I set no-pty in the authorized-files, is that the display
seems strange (loosing the width of the term). But the most important problem
is the fact that I can't type anything. I must kill this script from another
console.

However, the command "ssh -t user@computer" works fine !



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.