LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-04-2012, 05:32 AM   #1
cdhar
Member
 
Registered: Jul 2012
Posts: 41

Rep: Reputation: Disabled
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
 
Old 07-04-2012, 05:57 AM   #2
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
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.

Last edited by tronayne; 07-04-2012 at 08:40 AM. Reason: Clarify as three options
 
Old 07-04-2012, 06:00 AM   #3
arodlinux
Member
 
Registered: Apr 2008
Distribution: Slackware64 14.2
Posts: 89

Rep: Reputation: 35
No. Login as root using su and then useradd <username> .
 
Old 07-04-2012, 06:54 AM   #4
cdhar
Member
 
Registered: Jul 2012
Posts: 41

Original Poster
Rep: Reputation: Disabled
Thanks for quick inputs. So how to get root privilege to my account?
 
Old 07-04-2012, 07:07 AM   #5
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
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.
 
Old 07-04-2012, 07:09 AM   #6
uk.engr
Member
 
Registered: Apr 2012
Posts: 131

Rep: Reputation: Disabled
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

Last edited by uk.engr; 07-04-2012 at 07:25 AM.
 
Old 07-04-2012, 07:50 AM   #7
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
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.

Last edited by TobiSGD; 07-04-2012 at 07:51 AM.
 
Old 07-04-2012, 08:11 AM   #8
uk.engr
Member
 
Registered: Apr 2012
Posts: 131

Rep: Reputation: Disabled
Actually I achieved same task through the same way thats why I shared. Ok dear you are right.
 
Old 07-04-2012, 08:51 AM   #9
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
Quote:
Originally Posted by cdhar View Post
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Does have a user in group 'root' all the rights as the user 'root'? thomas2004ch Linux - Newbie 4 08-12-2010 05:18 AM
how to create oracle, osinstall, osoperate user and group in root level jimmy zhu Linux - Server 1 10-27-2008 09:05 AM
Giving a user root permission via the root group louisb Linux - Security 6 07-23-2007 12:56 AM
create user with secondary group levis_inferno Linux - Networking 6 05-31-2006 12:33 AM
Every file I create has a group different than root. How do I find out where this is rfelter Linux - Software 4 04-16-2004 09:28 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:25 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration