Can I run sudo commands without specifying absolute path?
Issue
- Can I run sudo commands without specifying absolute path?
- While running custom commands and scripts via sudo using relative path, command fails with following error:
[root@localhost ~]# sudo my_test_cmd -l
sudo: my_test_cmd: command not found
- Same command works correctly with absolute path of command/script:
[root@localhost ~]# sudo /opt/custom_application/my_test_cmd -l
Custom_Application started Successfully.
Environment
- Red Hat Enterprise Linux 5
- Red Hat Enterprise Linux 6
- Red Hat Enterprise Linux 7
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.