I recently installed openSUSE 13.1 on a machine that had previously 11.4 (my main computer is 12.2, so I’m not such a fossil…). This is a clean install (as always). sshd is enabled on this machine, and let’s say that I open a remote session on that machine through ssh, then su, then issue reboot.
The result is that this shell will freeze for many minutes, without displaying anything. Frozen enough that ctrl-c/ctrl-d won’t take it out of its misery (unless I manually close that tab in konsole, which I find rude). The same thing will happen if someone at this remote machine reboots it while I am in through ssh, and this is very unpleasant because I get a frozen shell with little clue of what’s going on.
In contrast, I have another machine where I connect through ssh, which got 12.2, and upon shutdown or reboot it prints on screen the usual broadcast warning that it’s gonna shutdown and immediately breaks the connection. I had the same behavior with 11.4 before installing 13.1.
Did you observe anything like that? Is there some new way of configuring ssh that came up lately? Or maybe I’m doing something that was not meant to be. Just checking that before submitting a bug.
The remote machine: openSUSE 13.1 (updated), x86_64.
The local machine: openSUSE 12.2, x86_64
Great stuff from the manpage though. What you want is tilde followed by
dot/period:
Code:
ESCAPE CHARACTERS
When a pseudo-terminal has been requested, ssh supports a number of
functions through the use of an escape character.
A single tilde character can be sent as ~~ or by following the tilde
by a character other than those described below. The escape character
must always follow a newline to be interpreted as special. The escape
character can
be changed in configuration files using the EscapeChar configuration
directive or on the command line by the -e option.
The supported escapes (assuming the default ‘~’) are:
~. Disconnect.
~^Z Background ssh.
~# List forwarded connections.
~& Background ssh at logout when waiting for forwarded
connection / X11 sessions to terminate.
~? Display a list of escape characters.
~B Send a BREAK to the remote system (only useful for SSH
protocol version 2 and if the peer supports it).
~C Open command line. Currently this allows the addition of
port forwardings using the -L, -R and -D options (see above). It also
allows the cancellation of existing port-forwardings with
-KL[bind_address:]port for
local, -KR[bind_address:]port for remote and
-KD[bind_address:]port for dynamic port-forwardings. !command allows the
user to execute a local command if the PermitLocalCommand option is
enabled in ssh_config(5).
Basic help is available, using the -h option.
~R Request rekeying of the connection (only useful for SSH
protocol version 2 and if the peer supports it).
–
Good luck.
If you find this post helpful and are logged into the web interface,
show your appreciation and click on the star below…
I’m learning something here, and taking notes. It would be best if the broadcast message was there, but for my purpose, it 'll do.
I was confused for a moment how you enter that break sequence, as it feels very unnatural to just go type “~.” in a shell, so I will put emphasis for posterity. Immediately after newline. “~.” works fine and is my friend now.
The problem is that the sshd.service file in systemd does not have a stop option. I added ExecStop to sshd.service. I am sure that there is a better way of stopping sshd, but I will let the opensue team come up with that.
Dave W
ExecStop=/usr/bin/killall sshd
vi /usr/lib/systemd/system/sshd.service
systemctl daemon-reload
reboot