I have the following simple script that changed ownership on folders
more hola_config.sh #!/bin/bash chown -R hola:pola /home/darna chmod -R 775 /home/darna in /etc/sudoers I added the following ( super_hola user is like super user )
super_hola ALL=(ALL) NOPASSWD:ALL but when I run the script as
su super_hola whoami super_hola sudo -u super_hola ./hola_config.sh I get Operation not permitted from chmod from the script
Example:
chmod: changing permissions of ‘/home/darna/linux.cvg: Operation not permitted the question is
why the super user as super_hola can't change the permission like root user and what to fix in my configuration in order to enable user – super_hola to do so
here the user and group IDs
id super_hola uid=1001(super_hola) gid=1001(pola) groups=1001(pola),982(docker) grep super_hola /etc/group docker:x:982:super_hola id -G super_hola 1001 982
sudoas (and what are thesudoersrules for that user)? Is thesuper_holauser a user withUID=0?sudocommand? It appears that you try to change the identity of the current user tosuper_hola, not that you try to change fromsuper_holato root../fix_perm.sh. From the other user, it would be done withsudo ./fix_perm.sh. There is no point to becomingsuper_holaif you are already root, and there is no point to running the script assuper_holausingsudo -u super_hola.