When I run
export USERNAME=root
in zsh it gives me the following error.
zsh: failed to change group ID: operation not permitted
Any idea why?
PS: I did not manually run this initially, but I came across this when my vim-dispatch plugin threw this error while running a command in vim. Afterwards I was able to reproduce this by just running it in any zsh shell.
The parameter USERNAME corresponds to the real user ID of the shell process. Modifying it also changes the real user ID, effectively changing the permissions of the running shell process. This is of course only possible, if the original user has sufficient privileges. In most cases this probably means that only root is allowed to assign to USERNAME, while any other accounts are not permitted.
For example, consider this shell session:
root@host# echo $USERNAME $UID $EUID $GID $EGID
root 0 0 0 0
root@host# USERNAME=adaephon
adaephon@host% echo $USERNAME $UID $EUID $GID $EGID
adaephon 1000 1000 1000 1000
adaephon@host% USERNAME=root
zsh: failed to change group ID: operation not permitted
adaephon@host% echo $USERNAME $UID $EUID $GID $EGID
adaephon 1000 1000 1000 1000
Starting out as root, I can easily drop my privileges to my normal user account. But I cannot switch back to root as adaephon lacks the necessary privileges.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With