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

If a new user is added to config file but NOT at the end of the file, permissions get messed up and I get PermissionError's #418

Open
nathanielobrown opened this issue Sep 25, 2024 · 0 comments

Comments

@nathanielobrown
Copy link

Summary

My analysis so far is that there is an issue with chown setting the wrong permissions for folders if new users are added NOT at the end of the config file.

Context

My config file looks like and is mounted into the pod at /etc/sftp:

user1:asgfafadfasdf:e:::upload,download
user2:asfgdasdfasdfsd:e:::upload,download
user3:asdfasdfsdfdsf:e:::upload,download

I have a persistent storage volume mounted to /home

Periodically I add new users and restart the SFTP container. I've found that if a new user is added not at the end of the file, than existing folders for users that come after the new user in the config file will have their permissions changed to be owned by the previous user in the config file. I think removal of connections might also cause the same issue, and there's a chance I have whether it is the previous or next user that get's set of the owner.

I've mostly avoided having the order of the file changed (new users always go at the end, try not to remove users), but due to an occasional pattern of user deactivation and reactivation I really need to come up with a better solution.

Analysis

Potential Solutions

  • Maybe chown -R "$uid:users" "$dirPath" could be changed to chown -R "$user" "$dirPath"?
    • Someone who knows better than me should comment on whether this would have unintended consequences!
  • Maybe there's something I can do to avoid this issue? I think this is a clear bug but would love a mitigation if anyone has one
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

1 participant