Bug#982392: ssh-copy-id: create ~/.ssh with default SELinux context

Colin Watson <[email protected]>
Newsgroups gmane.linux.debian.devel.ssh
Message-ID <20210212193808.GT13361__2464.93423344276$1613158943$gmane$org@riva.ucam.org>
On Tue, Feb 09, 2021 at 05:55:00PM +0100, Christian Göttsche wrote:
> ssh-copy-id(1) does create the directory ~/.ssh if it not already
> exists. It also runs later, if available, restorecon(8) on the
> directory, to correct the SELinux context of it.
> It would however be idiomatic to create the directory already with the
> default SELinux context, to prepare for restorecon failures and avoid
> potential races.

This code is run on the remote system.  Therefore, won't this break
ssh-copy-id against remote systems that lack mkdir -Z, such as systems
with coreutils < 8.22 (released towards the end of 2013, which is
certainly a while ago now but there are still systems in extended
support that lack it, such as Ubuntu 14.04), or indeed systems with
non-GNU versions of mkdir?

I think it has to be done this way for portability, even if it's less
idiomatic on systems with modern GNU coreutils.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.