DockerCLI/cli/config/configfile
Sebastiaan van Stijn 22a291f703
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>
2019-12-17 09:57:33 +01:00
..
testdata Simplify cli plugin config file entry 2019-02-25 10:38:48 +00:00
file.go config: preserve ownership and permissions on configfile 2019-12-17 09:57:33 +01:00
file_test.go Fix lint issue 2019-10-16 09:59:49 -07:00
file_unix.go config: preserve ownership and permissions on configfile 2019-12-17 09:57:33 +01:00
file_windows.go config: preserve ownership and permissions on configfile 2019-12-17 09:57:33 +01:00