Mailing List Archive

Tiny usability problem with ControlMaster
Hi,

macos-10.14.6
macports-2.6.4
OpenSSH_8.4p1, OpenSSL 1.1.1i 8 Dec 2020 (via macports)

I've been using ControlMaster, ControlPath and
ControlPersist in my ~/.ssh/config for a little while
now, and I've noticed a tiny problem that I'd like to
fix.

If my current working directory is on a removable
drive's file system (e.g. a USB stick), and I run
ssh/scp to a new host and a new control socket is
created, I later find that I can't unmount the
removable drive, because the long-running ssh process
that holds the control socket open has inherited its
current working directory from my shell when I started
ssh/scp. I need to terminate that ssh process before I
can cleanly unmount the removable drive.

If there's no good reason to retain the inherited
current working directory, would it be OK to change ssh
so that the process that handles the control socket
changes its current working directory, either to the
root directory, or to the user's home directory, or to
the directory containing the ControlPath?

I'm happy to supply a patch or pull request to change
this if it's worthwhile. Is it? Which directory should
the long-running ssh process change to? Changing to the
root directory is the simplest thing with the least
code, and so would be my preference. But the other
choices seem reasonable as well.

Thoughts?

cheers,
raf

_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
Re: Tiny usability problem with ControlMaster [ In reply to ]
On Fri, Feb 05, 2021 at 03:51:56PM +0100, Christian Hesse <mail@eworm.de> wrote:

> raf <ssh@raf.org> on Thu, 2021/01/28 14:53:
> > I've been using ControlMaster, ControlPath and
> > ControlPersist in my ~/.ssh/config for a little while
> > now, and I've noticed a tiny problem that I'd like to
> > fix.
>
> Is ControlPath set to a relative path? Just change that to an absolute path
> that is always available and writable for your user.
> --
> Best regards,
> Chris

ControlPath is already set to an absolute path: ~/.sshctl/%C

That's not the issue. There is no problem with the
ControlPath being used (i.e. available and writable).

The issue is that the long-running ssh process that
keeps the control socket open is retaining the current
working directory that it started with, rather than
changing directory to / (or the directory containing
the contol path) so as to avoid hampering umounts. So
when that current directory is on a removeable drive's
file system, it can become impossible to unmount that
file system without first killing that ssh process.

cheers,
raf

_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev