docker / docker/docker-credential-helpers
docker-credential-pass has wrong $HOME directory when running docker with sudo
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 1.3k
- Forks
- 195
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 5
Description
I'm not overly familiar with this repo, but I've just wrestled with docker-credential-pass for an hour and now I've figured out the problem it seems quite fixable.
The error is this: Error saving credentials: error storing credentials - err: exit status 1, out: pass store is uninitialized.
Here's how this problem can occur:
- The user initialises their pass store with
pass init, creating the~/.password-storedirectory. - They download docker-credential-pass and add it to their $PATH.
- They attempt to login with
sudo docker login(not using sudo would cause permission errors). - The login succeeds but with the above error - their credentials haven't been saved, and it claims pass store is uninitialized even though it definitely is.
The cause is that, in some configurations of Linux, the root user has a different ~ (home directory) to the normal user. This means docker-credential-pass is looking in the wrong place for the pass store; on my machine I believe it was looking in /root/.password-store. I fixed this on my own machine by editing /etc/sudoers so that the root user keeps the $HOME env variable of the normal user, but it seems that the program could be edited in some way to avoid this requirement altogether, or at least to provide a more useful error message. If I was familiar with Go I would attempt to make this change myself.
Note: this may be the cause of issue #140 , I'm not sure.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no files or tests. Start by tracing docker-credential-pass handling of $HOME and the pass store, then compare the possible relationship with issue #140. Done means the behavior under sudo is defined and either avoids the wrong pass-store location or provides a more useful error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- authentication, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100