error in running bash script as root
Don't use setuid shell scripts, the SUID bit is not honored on shell scripts anyway on current systems. Use sudo
instead, as you attempted anyway:
eka ALL=NOPASSWD: /home/eka/test/test.sh
And then:
eka$ sudo ~/test/test.sh
With that, test.sh
will be executed as "root". No need to use setuid here.