LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 04-11-2012, 12:09 AM   #1
MudPuppy
LQ Newbie
 
Registered: Oct 2003
Distribution: Slackware 15.0
Posts: 11

Rep: Reputation: 0
Good practice - group memberships


Hi all,

I was wondering what group(s) one should make your main user a member of. I haven't found a clear answer while searching around.

In Windows I'm used to always working with local admin rights, but in Slackware I'd prefer to follow the advice of creating a user. Which I did I just have no clue what all the groups do exactly, and what the most commonly used ones are for a "superuser" for instance.

Mud
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 04-11-2012, 12:50 AM   #2
roger_heslop
Member
 
Registered: Oct 2009
Location: Leander, TX
Distribution: Fedora 20
Posts: 97

Rep: Reputation: 35
In Red Hat when a new user is created with the useradd command, a group of the same name is created and the new user is automatically added to said group. Of course you can put the user in any other groups with the supplemental 'usermod -a -G $user $group' command, but as far as conventions... that's all I know. (As they say, if you want to know Red Hat use Red Hat, if you want to know Linux, use Slackware

Anyway you essentially want your user to be a part of any group he will have group permissions for. So if root has a file with permissions rwxrwx---, and the file is owned by user/group root:root, then anyone in the the group root will have rwx permissions. So it would make sense that the main user at least be in the group root supplementally. But again it's hard to talk about conventions without bringing in different distribution philosophies, LDAP, etc. into the conversation. Hope that helps a little - anyone else?
 
Old 04-11-2012, 01:18 AM   #3
willysr
Senior Member
 
Registered: Jul 2004
Location: Jogja, Indonesia
Distribution: Slackware-Current
Posts: 4,661

Rep: Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784
when you created a new user, you can just use the up arrow to add additional groups which should be safe for normal use besides the default "users" group
 
Old 04-11-2012, 06:45 AM   #4
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
The purpose of groups is to allow users to access files and utilities that they would not otherwise have access to; "users" in this context means everybody but root.

There is a basic rule of multiuser, multitasking operating systems (Windows is not one of those): Thou Shalt Not Work as Root (because you can do a lot of unintended damage really, really quickly). Essentially, you only want to be logged in as root (or use su or sudo) as rarely as possible. But, as a user, you do need to be able to, you know, do stuff so a way needs to exist that lets you. That's what groups are for.

The pretty much standard default mask for creating files and directories, where owner, group and public access permissions are set, is 0022 (this is an octal value that is used by the system when you create a file or directory). See the manual page for the umask utility for more. With that umask value, every time you create a file it will have a mask that looks like this:
Code:
ls -l item.txt
-rw-r--r-- 1 trona users    4672 Jan  6 11:36 item.txt
That's three sets of permissions: owner (you), group (others know to you) and public (anybody else). In this case, I have read-write, users can read and public can read.

That's files. Directories get created with
Code:
ls -l
drwxr-xr-x  4 trona users     4096 Dec 31 11:45 tools/
It's a directory, I have read, write and execute, the group as read and execute and public has execute (which implies read).

That's the default (and it's a good default). If you wanted other users to have write permissions to files you've created you can add that with
Code:
chmod 664 item.txt
and, to allow write access in a directory
Code:
chmod 775 tools
Now, you'd do this kind of thing if you're working on a project with other users. You'd create a directory somewhere (not in anybody's home directory, perhaps in /usr/local), make it writable (chmod 775 dirname) and then have users add group write permissions to any files they create in that directory (chmod 664 filename). Actually this is a little convoluted and there are other ways to accomplish it but we're looking at basics here.

Back to your original question, here's a good set of groups for an ordinary user to belong to:
Code:
groups
users lp floppy dialout audio video cdrom plugdev power usbfs netdev scanner
Contrast this to the groups root belongs to:
Code:
su -
groups
root bin daemon sys adm disk wheel floppy audio video cdrom tape plugdev power usbfs netdev scanner
(and, no, you do not want to add uses to those).

Having a user belong to the groups listed above lets a user do things that otherwise would require root permissions; e.g., plugdev lets you plug in a memory stick and read and write it, lp and scanner lets you use a scanner.

The permission masks and groups are there so users can do what they need to without the need (or the ability) to do things they shouldn't be doing -- keep in mind that the system is designed to support hundreds of users (even though it's just "you" on your own system) and those "checks and balances" are there to make that feasible. There is a discussion at http://en.wikipedia.org/wiki/Group_identifier that you may find useful.

Hope this helps some.
 
3 members found this post helpful.
Old 04-11-2012, 08:03 AM   #5
MudPuppy
LQ Newbie
 
Registered: Oct 2003
Distribution: Slackware 15.0
Posts: 11

Original Poster
Rep: Reputation: 0
Big thanks tronayne! That was very informational and helpful.

In my case (a desktop / laptop environment where only my spouse and I use the machine) I often do need the root user to be able to install programs, set up network, etc. So I do want some extra permissions on my own user so that I don't have to switch to the root too often. I'll look into sudo more as well in any case. It's all still very new to me, but I've learned a heck of a lot in the past week.

In any case, I believe nderstand the concept now from a multi-user point of view.

Is there any documentation on the groups and what they allow the users belonging to them do exactly?
 
Old 04-11-2012, 11:37 AM   #6
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:
Is there any documentation on the groups and what they allow the users belonging to them do exactly?
Not really.

There are things you must do as root -- setting up networking, adding user accounts, install programs and the like. You can do those things using sudo or su - or a direct log in as root; just be careful as you use any of those methods because there is absolutely nothing that will prevent you from doing anything at all. Make sure before you hit the carriage return rather than after, eh?

By belonging to a given group (other than users), you'll be able to do things as suggested above; e.g., use a scanner, use a memory stick, plug in your camera and unload photographs from it, those sorts of things. You will not be allowed to do "root" things, those are, wisely, reserved for somebody who knows the root password.

As you go on it'll get plainer; don't get all hung up worrying about groups, just add your user account(s), as root, sudo or su -, like this (if they're not already there -- simply execute the groups command to see what groups you do belong to):
Code:
usermod -a -G lp,scanner your_user_id
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
[Samba] Updating local group memberships of user tom_s Linux - Networking 2 01-10-2012 08:24 PM
Problem With Using pam_listfile and Secondary Group-memberships in Active Directory ferricoxide Linux - Enterprise 0 11-04-2010 04:03 PM
group permissions or symlinks best practice jmikeneedham Linux - Security 3 08-22-2009 05:00 PM
Samba + LDAP server issues with group memberships havok1977 Linux - Server 2 05-06-2009 05:59 AM
Accidentally deleted all my group memberships serg.kr Linux - Software 4 08-26-2007 10:59 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 01:00 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
Open Source Consulting | Domain Registration