[EdLUG] SSH - ssh-copy-id problem | RPi | Ubuntu.

Robert McWilliam rmcw at allmail.net
Tue Mar 30 09:04:51 UTC 2021


On Tue, 30 Mar 2021, at 06:48, Justin B Rye wrote:
> I don't think the commands are failing, exactly - that ought to give
> intelligible messages.  The remote machine is just hanging at the
> point of running it.

Yeah, one way to check what the SSH session is hanging on would be from another shell on the pi run something like:
pstree -sup $(ps aux | grep sshd |  awk '{print $2}' | sort -n | head -n 1)

I don't think pstree is in the default install so would need to add it.  The sort and head part is to get the  sshd process with the lowest PID, that'll probably be the daemon rather than any processes spawned from connections if the pi hasn't been on for too long, but if it's been on (and doing stuff involving spawning processes) for long enough that PIDs have wrapped then it might not be.  In which case something like this might work:
pstree -sup $(ps aux | grep /usr/sbin/sshd | grep -v grep |  awk '{print $2}')
or:
pstree -sup $(systemctl status sshd | grep "Main PID" | cut -d: -f2 | cut -d" " -f2)
I'm almost inclined to recommend that one as first try since ti is going to source of truth about the ssh daemon but I don't know how consistent systemd status output is between versions (or you might be using a distro that's not using systemd...). 

If none of those work then need to find the PID for SSH daemon manually, or run "pstree -sup" without a PID, it'll then give the whole process tree, if you odn't have a GUI environment running that might not be too bad. 

Robert
________________________________________________________
Robert McWilliam     rmcw at allmail.net    argh.technology

What do you consider to be your median achievement?



More information about the EdLUG mailing list