LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Non root user can create group? (https://www.linuxquestions.org/questions/linux-newbie-8/non-root-user-can-create-group-4175414840/)

cdhar 07-04-2012 05:32 AM

Non root user can create group?
 
Hi,

I am newbie. I got a linux server machine and need to create a new user to existing group of the machine. My question is can a NON root user can do this task? if yes how? I found uid is non zero value of my login and by googling I found that root user uid is 0. So I am considering I am not a root user.

Please provide your inputs.

Thanks,
cdhar

tronayne 07-04-2012 05:57 AM

A non-root user cannot create a new user or group and may not modify any user or group.

You must either (1) log in as root or (2) use su - or (3) use sudo to add or modify users or groups.

The UID for root is zero, everything or everybody else is non-zero; do not mess with that (as in, do not change any other user account to zero -- you can quickly break things).

Hope this helps some.

arodlinux 07-04-2012 06:00 AM

No. Login as root using su and then useradd <username> .

cdhar 07-04-2012 06:54 AM

Thanks for quick inputs. So how to get root privilege to my account?

TobiSGD 07-04-2012 07:07 AM

You don't add root privilege to your account, You will launch the necessary commands logged in as root or using the sudo command. Which one to choose depends on your distribution and/or how your machine is set up.

uk.engr 07-04-2012 07:09 AM

Assalam o Alaikum.

"So how to get root privilege to my account?"

run this command as a root "visudo"

-add following line below root ALL=(ALL) ALL
username ALL=(ALL) ALL

-add following line below # %wheel ALL=(ALL) NOPASSWD: ALL
username ALL=(ALL) NOPASSWD:ALL
save and exit

then try
sudo su
sudo useradd
etc

TobiSGD 07-04-2012 07:50 AM

This is bad advice, in many ways, I will explain to you why:
Quote:

run this command as a root "visudo"
The OP is asking how to do admin tasks as root user. Telling him he should do something as root user is at least a bit sarcastic, but in no way helpful.

Quote:

-add following line below root ALL=(ALL) ALL
username ALL=(ALL) ALL
This line will have absolutely no effect, since it will be overridden by the following line you advised the OP to add:
Quote:

-add following line below # %wheel ALL=(ALL) NOPASSWD: ALL
username ALL=(ALL) NOPASSWD:ALL
This is the worst part of the advice you gave. This will set up the system in a way so that anyone that (accidentally or maliciously) get access to the OP's account can do anything on the system without having to type in a password. This is a serious security hole and may even be considered as you giving malicious advice.

Security is a serious topic. If you have not a proper understanding about it please inform yourself before giving advices to newbies.

@cdhar: To give you better advice we need to know which distribution you are running on the machine where you have to change the user/group.

uk.engr 07-04-2012 08:11 AM

Actually I achieved same task through the same way thats why I shared. Ok dear you are right.

tronayne 07-04-2012 08:51 AM

Quote:

Originally Posted by cdhar (Post 4719001)
Thanks for quick inputs. So how to get root privilege to my account?

You don't. You must use the root password with
Code:

prompt: su -
Password: type_root_password_here

Linux is not Windows. The root account is for administrative tasks. User accounts are for dong user-oriented activities; e.g., editing files, web, mail, etc. The two do not mix.

By the way, you most likely have a utility named adduser. Once you've done the su -, simply
Code:

prompt: adduser
and supply the information requested by adduser then, when finished, type
Code:

exit
and you're all done.

Hope this helps some.


All times are GMT -5. The time now is 06:43 PM.