Commit Graph

1 Commits

Author SHA1 Message Date
Sebastiaan van Stijn 14010c88b4 config: preserve ownership and permissions on configfile
When running `docker login` or `docker logout`, the CLI updates
the configuration file by creating a temporary file, to replace
the old one (if exists).

When using `sudo`, this caused the file to be created as `root`,
making it inaccessible to the current user.

This patch updates the CLI to fetch permissions and ownership of
the existing configuration file, and applies those permissions
to the new file, so that it has the same permissions as the
existing file (if any).

Currently, only done for "Unix-y" systems (Mac, Linux), but
can be implemented for Windows in future if there's a need.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 22a291f703)
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2020-07-15 12:31:56 -07:00