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
updater.sh: cope if run with sudo [withdrawn see #1651 instead] #1595
Conversation
hi @earthlng, some small additions that 'might' help with [arkenfox#1587](arkenfox#1587)). Thank you. in version 3.5 if you run updater.sh with sudo then: (1) user.js may only be readable by root and not load for the Firefox user (2) if the script is run first time with sudo, then again without sudo, permissions from the previous run may cause issues (eg no backup or update of user.js) with little or no warning. Therefore v3.6 to: (1) set some file/dir permissions (on those created) if run with sudo (2) show info if some access permissions are not as expected (3) added some further error messages
|
(I don't know how macOS works they may do different stuff for root.) https://stackoverflow.com/questions/18215973/how-to-check-if-running-as-root-in-a-bash-script I doubt it will matter but this may catch more https://stackoverflow.com/a/65358284: |
|
@CelestialNebula's suggestion makes sense, you should definitely not run a command or script with @CelestialNebula I have macOS and wouldn't mind testing anything if needed. |
|
@mhmdanas If you could test this to confirm: test.sh:
If it worked you should see: You shouldn't run this as root. Edit: Look for a line with something like [1] https://zsh.sourceforge.io/Doc/Release/Parameters.html#Parameters-Set-By-The-Shell |
|
@CelestialNebula apologies for the delay. I tested the script you provided with macOS's Dash, Bash, and Zsh (because macOS allows you to choose which of these shells
There is no line in my /etc/group file that begins with |
|
@mhmdanas can you test this? This is going to run recursively so you should probably make a directory test.sh: First you will need to make a file with sudo Then remove |
|
Sorry for the delay, I totally forgot about your comment. I followed your steps with both Dash, Bash, and Zsh, and it worked with all of them. Note that the output was this with all shells: |
Check if running as root and if any files have the owner/group as root|wheel. Abort on both. Should (hopefully) prevent stuff like: arkenfox#1587 Discussion: arkenfox#1595
|
Withdrawn in favor of #1651. Closing without further action. |
* updater.sh/prefsCleaner.sh: Check for root and abort Check if running as root and if any files have the owner/group as root|wheel. Abort on both. Should (hopefully) prevent stuff like: #1587 Discussion: #1595 --------- Co-authored-by: Mohammed Anas <triallax@tutanota.com> Co-authored-by: earthlng <earthlng@users.noreply.github.com>
hi @earthlng, some small additions that 'might' help with #1587. Thank you.
in version 3.5 if you run updater.sh with sudo then: (1) user.js may only be readable by root and not load for the Firefox user (2) if the script is run first time with sudo, then again without sudo, permissions from the previous run may cause issues (eg no backup or update of user.js) with little or no warning.
Therefore v3.6 to: (1) set some file/dir permissions (on those created) if run with sudo (2) show info if some access permissions are not as expected (3) added some further error messages