Sample Header Ad - 728x90

Why I cannot find (using which) usermod as a regular user in RHEL7

1 vote
1 answer
2134 views
Any ideas why the which command is unable to find the usermod command in rhel 7. Here is what I did (and corresponding output) [ec2-user@ip-10-0-4-109 ~]$ echo $PATH /usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/ec2-user/.local/bin:/home/ec2-user/bin [ec2-user@ip-10-0-4-109 ~]$ which usermod /usr/bin/which: no usermod in (/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/ec2-user/.local/bin:/home/ec2-user/bin) [ec2-user@ip-10-0-4-109 ~]$ sudo su [root@ip-10-0-4-109 ec2-user]# which usermod /sbin/usermod [root@ip-10-0-4-109 ec2-user]# readlink -f /sbin/ /usr/sbin So the gist of the issue is that usermod is physically located in /usr/sbin/usermod. This directory /usr/sbin is in ec2-user search path. But for some reason which command is not returning it when I run it as ec2-user. Any ideas why this is happening on RHEL 7? I also have Ubuntu 14.04 and it works as expected (both root and regular user can see usermod in /usr/sbin). After initial post here is what else I found out: +++++++++++++++++++++++++++++++++++++++++ I found some addition information and I think this may have something to do with this: On RHEL 7 the permission bits for usermod -rwxr-x---. 1 root root 113800 Jun 28 2016 /usr/sbin/usermod On Ubuntu 14.04 the permission bits for usermod -rwxr-xr-x 1 root root 110296 May 16 19:37 /usr/sbin/usermod So I am guessing not having read permission for regular user on usermod maybe causing this?
Asked by sshekhar1980 (541 rep)
May 28, 2017, 02:09 PM
Last activity: Jul 11, 2025, 11:02 AM