Linux - NewbieThis 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
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.
creating groups and user and passwd is a root dude only thing, you have to go su or su - or sudo in order to create. change, these items.
when you try to use newgrp and it asks for password it is talking about the root user pass word not user pass word.
when you are in a user login and you su then enter password you've essentially just bypassed typing sudo newgrp then it'd prob still ask you for a pass word, all depending on how you have your sudo user(s) set up in the suduers file, in /etc. you can fix it so you do not have to use a pass word on sudo <command> .
what you did by using su first is just put yourself into superUser Mode that has root access is all, instead of loging out then back in as root.
too you mayhave to ensure that the user is attached to the group your working with newgrp is new to me. though it is logical that one has to be attached to a group before they can log into it as I just read about his newgrp command a little bit . but just the same try using root pass word and see if that is it.
by what this reads is looks just like using su or sudo but not su - then a password for vaildate the login, giving that person the rights that this group has .. but not on a file, yes just within that other person login session.
when you touch filename it automaticly gives it the one who created it ownership and there group attached to it.
this is interesting I've never seen this newgrp before...
so basicly forget everything (almost everything I just said) it seems logically you'd be getting asked for the password of that group. but again the group itself and not a file attached to that group.
Quote:
newgrp is used to change the current group ID during a login session.
If the optional - flag is given, the users environment will be reini-
tialized as though the user had logged in, otherwise the current envi-
ronment, including current working directory, remains unchanged.
creating groups and user and passwd is a root dude only thing, you have to go su or su - or sudo in order to create. change, these items
Really? I think newgrp command throws a wrench into this statement. I agree you have to be root/sudo/wheel to run usermod, useradd or userdel, however the example for newgrp doesn't going into detail who's passwd has to be entered when this command is issued.
Quote:
Originally Posted by BW-userx
when you try to use newgrp and it asks for password it is talking about the root user pass word not user pass word.
From the newgrp man page
Quote:
If not root, the user will be prompted for a
password if she does not have a password (in /etc/shadow if this user has an entry
in the shadowed password file, or in /etc/passwd otherwise) and the group does, or
if the user is not listed as a member and the group has a password. The user will be
denied access if the group password is empty and the user is not listed as a
member
Quote:
Originally Posted by BW-userx
by what this reads is looks just like using su or sudo but not su - then a password for vaildate the login, giving that person the rights that this group has .. but not on a file, yes just within that other person login session.
I got it to work by su -l jbaxter and also making sure jbaxter was in the group and then I was able to use newgrp testing and the file I created has the group testing.
that newgrg threw me, just the word new then grp made me think it was a command to create a new group, then after I wrote what I did, then looked further into it, then it was time to catch the last bus, and that took precedence over what I was typing in here, but,
by what I see it is to log into a group to gain group privages, nothing more. it acts just as if one is loging into su, and by using the - switch it puts them into their own home, if not used then they stay in the user they are in home enviroment. just like loging in to
Code:
su -
that gets the person back to root home and enviroment, where as just
Code:
su
gets a person root privages, keeping them in the users home and enviroment that they are in when they logged in as su.
So when one uses this newgrp they have to specify the group they are wanting to login to. it has nothing to do with creating a file and what group it is attached to.
the group itself is then set up with permissions to govern what that user can and cannot do.
real world use would then be to give others root privages but not all of them, it is to limit what they can do.
it is the group that has a password, therefor it is a group password attached to that group one is trying to sign into.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.