LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   newgrp root asks for password i dont have (https://www.linuxquestions.org/questions/linux-newbie-8/newgrp-root-asks-for-password-i-dont-have-4175590113/)

sigint-ninja 09-25-2016 06:15 AM

newgrp root asks for password i dont have
 
if i wanted to add group root as my primary group (this is prob bad practice im guessing)

and i use:
newgrp root

it asks me for a password

nor mine or root work...why is this?

sigint-ninja 09-25-2016 06:25 AM

read this later on:

To be able to use the newgrp command, a user has to be a member of that group.
Alternatively, a group password can be set for the group using the gpasswd com-
mand. If a user uses the newgrp command but is not a member of the target group,
the shell prompts for the group password. After you enter the correct group pass-
word, the new effective primary group is set.

i dont understand this,"a user has to be a member of that group" isnt that the point of this command to add a member to the root group?
or is it only to set it as the primary group?...so you need to be part/member of the group you want to set as the primary group...is that right?

af7567 09-25-2016 07:06 AM

newgrp is for changing what your current active group is, but you must be in that group or know the password already.

If you want to add yourself to a group use the usermod command. Look at the -a and -G options

sigint-ninja 09-26-2016 10:29 AM

thanks for that...yes i realized my confusion...thanks for clearing it up

aragorn2101 09-27-2016 03:46 AM

Hi,

If you want to add groups to your user, you should the usermod command instead. Read the man pages for usermod. It is quite clear. You can do all sorts of modification as well.

BW-userx 09-27-2016 07:26 AM

Quote:

Originally Posted by sigint-ninja (Post 5609797)
read this later on:

To be able to use the newgrp command, a user has to be a member of that group.
Alternatively, a group password can be set for the group using the gpasswd com-
mand. If a user uses the newgrp command but is not a member of the target group,
the shell prompts for the group password. After you enter the correct group pass-
word, the new effective primary group is set.

i dont understand this,"a user has to be a member of that group" isnt that the point of this command to add a member to the root group?
or is it only to set it as the primary group?...so you need to be part/member of the group you want to set as the primary group...is that right?

oh sigint-ninja I am so surprised at you, I've have read your other posts in here and you're freaking me out now. Why is your brain telling you to make a group called root, and not something else? better take a look at your sudoers file just to see what you see.

as far as using usermod command to add users to a group. use the switches like this
Code:

#usermod -aG [groupName] [userName]
the 'a' is to append that group to the list of groups the user already has, the G is to tell the command it is to be dealing with Groups. if you just use the -G without the 'a' then you will lose every group that user was assigned to in the proccess.

Linux and Unix newgrp command

Code:

userx@voided & ~ >> $newgrp lxdm
Password:
newgrp: crypt failed: Invalid argument
newgrp: permission denied

the newgrp is just the command used by a user to log into a different group that has already been established and set up properly in order to use its (that groups) privages

say if you have a group that has permissions to modify the printer setting how where and how to send stuff to get printed to one or more printers. then you assign some people to that group so they can fix it if it breaks. then one of them users all they have to do is log into that group to do so?

if a password was given to that group then they got a know it, or one of them users in that case could tell someone that is not in the group to log in and fix it, then give them the password or type it in for them and they now can have the groups premissions to do so? just by using the command newgrp [groupName]

that is what it looks like to me.

sigint-ninja 09-28-2016 11:30 AM

BW-userX "oh sigint-ninja I am so surprised at you, I've have read your other posts in here and you're freaking me out now." ??? were my other posts just as poor? or better?

anyway...i wasnt trying to make a group called root,just trying to add my user to the root group,but i understand the differences
now...and the posts here,especially yours helped clear things up.

in my defense the only time i get to do this stuff (the stuff i like) is pretty late after my working day...so forgive me if my brain backfires every once in a while...and to add..im not getting any younger here!!!

thanks again guys,as always,your the greatest!!!


All times are GMT -5. The time now is 11:45 AM.