LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 05-13-2004, 02:39 PM   #1
Menestrel
Member
 
Registered: Oct 2003
Location: Bucharest
Distribution: Debian Sarge, Slackware Current, Ubuntu
Posts: 183

Rep: Reputation: 30
how to change user group ?


what command from the CLI should I run to change the group a user is in ?
 
Old 05-13-2004, 02:42 PM   #2
TheOther1
Member
 
Registered: Feb 2003
Location: Atlanta, GA
Distribution: RHAS 2.1, RHEL3, RHEL4, SLES 8.3, SLES 9, SLES9_64, SuSE 9.3 Pro, Ubuntu, Gentoo
Posts: 335

Rep: Reputation: 32
usermod:

-(~:#)-> usermod
usage: usermod [-u uid [-o]] [-g group] [-G group,...]
[-d home [-m]] [-s shell] [-c comment] [-l new_name]
[-f inactive] [-e expire ] [-p passwd] [-L|-U] name
 
Old 05-13-2004, 11:18 PM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671
Given the parameters $user and $grp, this line will give you a comma seperated list of groups that the user will belong to after $grp is removed. I believe that is what the -G option needs.
Code:
groups $user | sed  -e "s/$user\ ://" -e 's/ $grp//' -e 's/\ /,/g'
The line uses the groups command to print a groups of lists that the user belongs to. It is of the form:
user : group1 group2 ...

the sed command removes the initial 'user :' , removes the group from the list (as well as a leading space, and lastly replaces the spaces with commas.

Last edited by jschiwal; 05-13-2004 at 11:21 PM.
 
Old 05-14-2004, 10:51 AM   #4
comprookie2000
Gentoo Developer
 
Registered: Feb 2004
Location: Fort Lauderdale FL.
Distribution: Gentoo
Posts: 3,291
Blog Entries: 5

Rep: Reputation: 56
If you just wanted to add a user to a group;
bash:~# adduser whoever src
adding user whoever to group src...
 
Old 05-15-2004, 02:58 PM   #5
Menestrel
Member
 
Registered: Oct 2003
Location: Bucharest
Distribution: Debian Sarge, Slackware Current, Ubuntu
Posts: 183

Original Poster
Rep: Reputation: 30
thank you all for the quick answers. I also found out that I can edit the /etc/group file. is that correct?

I have one more question. About the default user groups that are created on linux. How can I find what rights has each group ?
 
Old 05-16-2004, 04:29 PM   #6
urka58
Member
 
Registered: Nov 2003
Distribution: slackware 14
Posts: 541

Rep: Reputation: 32
Groups do not refer to any permission right.
Permissions are "features" of files.
ie
ls -l output can be something like
-rw-r--r-- 1 root group1 5166 Apr 24 22:53 lspci.txt
where
leading - means it is a normal file
rw- means root has read write permissions
r-- means group1 has read permission
r-- means others have read permission

In this case the user "user1" included into "group1" group will have only read permission
Hope this helps
Ciao
 
Old 05-20-2004, 07:33 PM   #7
Menestrel
Member
 
Registered: Oct 2003
Location: Bucharest
Distribution: Debian Sarge, Slackware Current, Ubuntu
Posts: 183

Original Poster
Rep: Reputation: 30
but what if two groups have different permissions on a file, who can I see what each group can do to a file ? if i want group1 and group 2 to have read permissions group3 to have read and write permissions and group4 and group5 to have read write and execute permissions. Can I make these settings ? if I can, how could i view these settings ?
 
Old 05-20-2004, 11:09 PM   #8
TheOther1
Member
 
Registered: Feb 2003
Location: Atlanta, GA
Distribution: RHAS 2.1, RHEL3, RHEL4, SLES 8.3, SLES 9, SLES9_64, SuSE 9.3 Pro, Ubuntu, Gentoo
Posts: 335

Rep: Reputation: 32
Maybe this will help clear things up.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
How to list user in Linux box, add an user to a group! steady_lfcfan Linux - Newbie 12 01-27-2013 01:14 PM
How do I change a user's primary group? Akhran Linux - Newbie 4 03-19-2010 08:54 PM
User and Group Admin: How to tell Who is in What group? Akhran Linux - Newbie 1 11-12-2005 11:16 PM
how to change uid group id mfrangos79 Linux - General 1 11-07-2005 07:19 PM
change group blackzone Linux - Newbie 3 12-14-2004 04:30 AM


All times are GMT -5. The time now is 02:08 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration