Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intended use of non-root-user manipulation of /etc/passwd #47

Open
jennydaman opened this issue Apr 4, 2023 · 1 comment
Open

Intended use of non-root-user manipulation of /etc/passwd #47

jennydaman opened this issue Apr 4, 2023 · 1 comment
Assignees

Comments

@jennydaman
Copy link

Hello, I am confused about this code's intent.

# Add entry to /etc/passwd if we are running non-root
if [[ $(id -u) != "0" ]]; then
USER="autossh:x:$(id -u):$(id -g):autossh:/tmp:/bin/sh"
echo "[INFO ] Creating non-root-user = $USER"
echo "$USER" >> /etc/passwd
fi

If the user is not root, then they don't (unlikely) have write permission to /etc/passwd. So this block of code fails most of the time.

To run jnovack/autossh as a non-root user, I used a workaround where I pre-create /etc/passwd and mount it as a read-only volume.

@jnovack
Copy link
Owner

jnovack commented Apr 11, 2023

That's a great point. What do you suggest for changes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants