Cannot create a group in RHEL5. I get error groupadd: command not found.
3 Answers
It seems that groupadd is the correct command: RHEL5 admin. addgroup is a debian specific commnad.
Are you logged in as root? groupadd is in /usr/sbin which, by default, is not in the path. run echo $PATH and see if /usr/sbin is there. Not that running it as non-root is very helpful: you require root access to add a group.
-
2Or use the absolute path directly `/usr/sbin/groupadd
` – matthias krull Aug 26 '10 at 12:23 -
It's important how to switch to root before using ```groupadd``` command. ```su -``` hast path to ```sbin``` in ```PATH```. – Romasius Jul 11 '22 at 14:42
USING CENTOS 5.9
Make sure you have installed a FQDN (full qualified domain name), for example Centosbox.local. Then execute the following command as a user with sudo privileges:
sudo gedit /etc/sysconfig/network
Change the value of HOSTNAME from "whatever.unknown" to "whatever.local".
Reboot and enjoy using groupadd.
A common reason for not finding the groupadd command is that you are trying to access it as a user that does not have read access to the program, which is typically found in /usr/sbin/groupadd. You will need to assume the root user's identity, either with su or sudo or logging in as root, and then you should find the command.
I'm using Cent OS 7 and I see that the program's permissions do not allow others to read it:
#>ls -l /usr/sbin/groupadd
-rwxr-x---. 1 root root 61336 Mar 6 2015 /usr/sbin/groupadd
As you can see, no permissions are set for others, which explains why querying the program as a user other than root results in not finding it.
- 161
- 3