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

demo/script-05.sh should set ownership of directories before writing files to them? #60

Open
dannyk96 opened this issue Dec 10, 2024 · 1 comment

Comments

@dannyk96
Copy link

The demo script demo/script-05,sh has this order:
1 Create 8 user accounts
2 Create 2 filesets and 6 subdirectories below them
3 Loop and create lots of files in these directories as root
4 Chown the 2 filesets
5 Chown the created files to the new users

May I suggest two things to improve this:

  • Firstly I think the filesets chould be chowned to their users on creation?
  • Secondly would it be better to create the files as the actual users, rather than create as root (ie change the sudo to su $user and chown later. ie much more like the real world case?

In my case script-05.sh exited during the file creation loop (no error message), leaving all directories and files still owned by root :-(

@hseipp
Copy link
Member

hseipp commented Dec 11, 2024

Firstly I think the filesets chould be chowned to their users on creation?

This might be doable. No benefit from a script clarity perspective, but indeed more close to real world usage.
However, the current example does not fit at all (would cats or dogs own the pets fileset?). I need your help how to change.

Secondly would it be better to create the files as the actual users, rather than create as root (ie change the sudo to su $user and chown later. ie much more like the real world case?

Again I understand the use case, but adding this is for sure complicating the script. If you have an idea how to change in a smart way, Pull Requests are very much appreciated.

In my case script-05.sh exited during the file creation loop (no error message), leaving all directories and files still owned by root :-(

That should not happen and in fact never happened during my tests, so without any hint where it failed, nothing that can be done here.

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