Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
hello,
i am trying to add groups and users using command line , addgroup/groupadd/usradd/, but i am getting commands can not be found. i think i am missing some "group/user command line tools" that need to be installed so i could use those command from the terminal .
does anyone come accross something like that? what tools or packages am i missing that need to be installed?
The most likely problem is that the commands are not in your path (when logged in as root), and bash doesn't know where to find the commands. To determine if the commands are indeed installed, open a terminal and issue these commands;
locate useradd
locate groupadd
Bash will probably return something like: /usr/sbin/useradd and /usr/sbin/groupadd.
Since bash doesn't recognize the commands, then /usr/sbin is probably not in your path.
You can run the commands by giving the full path when you try to run the commands:
/usr/sbin/useradd and /usr/sbin/groupadd.
To permanently add /usr/sbin to your path, edit the file /etc/ld.so.conf, and add /usr/sbin, and save the file. Then run /sbin/ldconf to update your path configuration.
There is also a bash PATH and export PATH option to update, but I don't remember how it works.
thanks for the reply
i did what u said and found /usr/sbin/useradd and /usr/sbin/groupadd
now these are super user command when i add them as u explained to my both would that be security issue since regular users would be able to run the command too?
just a newbe question..
Should not be a problem. If you check the permissions on /etc and ld.so.conf, you will find that the user/group permissions are set for root/root. Users can't execute without root permission.
It's more the fact that the password and group files and only writeable by the root user, so when a normal user tries to run useradd, it'll go fine until it actually tries to modify the password or group file, and then konk out with an error. Users generally can run the programs in the sbin directories, but can't use them to modify the system set up because of the permission checks in the system (of course, all this goes out the window if stuff is misconfigured, like if /etc/passwd is world writeable or somesuch).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.