I have a script that displays the IP Address of a given network interface / device name.
I have placed it in
/bin/ip.sh
Code:
[root@mahadeva ~]# ip.sh eth0
192.168.56.15
But as I run it as another user, it doesn't work because the script contains the "
ifconfig" command:
Code:
[root@mahadeva ~]# su - DEV
[DEV@mahadeva ~]$ ip.sh eth0
/bin/ip.sh: line 3: ifconfig: command not found
Any user can run
ls command, for example, without any root privileges. I just found that my script and
ls have identical
ACL:
Code:
[DEV@mahadeva ~]$ getfacl /bin/ls
getfacl: Removing leading '/' from absolute path names
# file: bin/ls
# owner: root
# group: root
user::rwx
group::r-x
other::r-x
[DEV@mahadeva ~]$ getfacl /bin/ip.sh
getfacl: Removing leading '/' from absolute path names
# file: bin/ip.sh
# owner: root
# group: root
user::rwx
group::r-x
other::r-x
[DEV@mahadeva ~]$
So, how can I make my script to be executable by any user?
I looked at the
visudoers file but got confused as to what entries I should make there (if that is a possible solution).