Some questions about /etc/group

I’ve a fair understanding of what groups are for. But that doesn’t mean I know
which groups are used by what system processes etc…

I mean it doesn’t take much to figure out that if a user needs to use sound
applications then he may need to be a member of audio, pulse, and/or
pulse-access. But for all I know, pulse & pulse-access may give an ordinary
user too much. I mean it would make sense to me that one of them might be used
to USE sound and the other just to use it. But that would be guessing.

Other groups are less obvious. (I do know better than to give non-privileged
user the wheel group.) but there exist a number of groups that don’t seem to
be used by normal users, and some of them probably shouldn’t be added even to
superusers. But which ones? I mean NOT being a member of the group “tty”
doesn’t stop a user from using tty1 etc… so what is the group “tty” for?

I could go on & on about several groups. But I’m hoping there is a list
somewhere of what each one is for, and more importantly, which (if any) exist
solely for use by system process, and which to which really shouldn’t add even
a trusted superuser???


JtWdyP

Most of the time, there isn’t much that it is important to know.

I added myself to the “root” group, so that I can read “/var/log/messages” without being root.

The “tty” group traditionally has permissions to write to tty devices. The “write” command runs with membership in the tty group. So you don’t have to add yourself to the “tty” group to use that ability.

Some of the groups are there so that software can run with restricted permissions. Allowing “write” to run with group membership of the tty group is safer than allowing it to run as root.

I hope that helps.

Audio works for me without adding myself to the audio group. But perhaps I would need to be in that group to do audio from a tty login. I’m pretty sure that an X login already provides needed permissions. Maybe running “startx” from a terminal, instead of logging in at the X screen, would require additional group memberships.

In short, stuff mostly works without worrying about groups.

On 2012-11-25 22:47, JtWdyP wrote:

> I could go on & on about several groups. But I’m hoping there is a list
> somewhere of what each one is for,

AFAIK, no.

We try to guess what they are for. Some we do know.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” (Minas Tirith))

It would appear that on Nov 26, nrickert did say:

> jtwdyp;2506518 Wrote:
> > But that doesn’t mean I know which groups are used by what system
> > processes etc…
>
> Most of the time, there isn’t much that it is important to know.

Yeah, most of the time…

> I added myself to the “root” group, so that I can read
> “/var/log/messages” without being root.
>
> The “tty” group traditionally has permissions to write to tty devices.
> The “write” command runs with membership in the tty group. So you don’t
> have to add yourself to the “tty” group to use that ability.

Which is obviously not the same as typing text into a bash prompt on one of
them… Didn’t think I’d need that one much anyway.

> Some of the groups are there so that software can run with restricted
> permissions. Allowing “write” to run with group membership of the tty
> group is safer than allowing it to run as root.

Which is what I was getting at. I know they do that. But I’ve never been sure
which ones.

> I hope that helps.
>
> Audio works for me without adding myself to the audio group. But
> perhaps I would need to be in that group to do audio from a tty login.
> I’m pretty sure that an X login already provides needed permissions.
> Maybe running “startx” from a terminal, instead of logging in at the X
> screen, would require additional group memberships.

Which is part of why I want to know… I do use X. But I absolutely abhor
every single Display Manager I’ve ever encountered. I’ve been using startx for
a long time. Unfortunately the devs at most of the Linux distributions I’m
familiar with are not updating the startx scripts to do all the latest
initialization steps that they make sure happens when the Display Manager logs
a user in… This didn’t used to be as much of a concern. I didn’t need to know
which groups I needed, I simply replicated in my actual user account, whatever
group memberships the installer thought the initial user account needed. But
lately the said initial user hasn’t been being added to very many groups.

> In short, stuff mostly works without worrying about groups.

But a startx user sometimes needs more. I just recently went a little nuts
trying to get a non-root user to be able to play music in Bodhi Linux…

That computer has an built in nvidia card with a sound chip. If I used the DM
my user got sound, E17’s mixer gadget/module recognized the nvidia sound and
gave my user access to more sound channels than I knew what to do with…

When I disabled the DM so that I could boot to console, and use startx when/if
I’m ready for the GUI, that same E17 mixer was regulated to a dummy output
device. Yet if the root account ran startx it got full access to the sound,
which indicated that it wasn’t a runlevel thing…

It took me way too long to realize that all I had to do was to add my user
accounts to the audio group for it to work…

It would appear that on Nov 26, Carlos E. R. did say:

> On 2012-11-25 22:47, JtWdyP wrote:
>
> > I could go on & on about several groups. But I’m hoping there is a list
> > somewhere of what each one is for,
>
> AFAIK, no.
>
>
> We try to guess what they are for. Some we do know.

That was what I was afraid of… I guess I’ll have to go back to guessing myself.
I just wish I knew which ones {besides root} are too dangerous to add to regular
user accounts. {sigh}


JtWdyP

You might need audio and video groups. You might also need modem and dialout groups, depending on what you are doing.

I’m not sure what the cdrom group is for. Perhaps it has to do with writing CDs. If I were doing things from the terminal, I would probably su to root for mounting/unmounting and burning anyway.

Most of the others that I see on my system are special purpose for running particular software with restricted permissions.

nrickert wrote:
>
>
> Most of the time, there isn’t much that it is important to know.
>
> I added myself to the “root” group, so that I can read
> “/var/log/messages” without being root.
>

I wouldn’t do that.
Instead I would (I do) read logs being sudoer.

I would (I have, for long) add commands like tail to my user to be used
without password and I would (I have) put a line to the user’s ~/.alias:

alias tail=“sudo tail”

I also find “mount” to come handy:

alias mount=“sudo mount”
alias umount=“sudo umount”

To make log tailing even simpler I have:

alias tale=“sudo tail -f /var/log/messages”

Vahis

http://waxborg.servepics.com
openSUSE 11.4 (x86_64) 2.6.37.6-0.20-default main host
openSUSE 12.2 (x86_64) 3.6.7-12-desktop Tumbleweed in VirtualBox
openSUSE 12.2 (i586) 3.4.11-2.16-desktop in EeePC 900

On 2012-11-26 07:54, Vahis wrote:
> nrickert wrote:

>> I added myself to the “root” group, so that I can read
>> “/var/log/messages” without being root.
>>
>
> I wouldn’t do that.
> Instead I would (I do) read logs being sudoer.

Why not?


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” (Minas Tirith))

On 2012-11-26 05:34, JtWdyP wrote:
>> We try to guess what they are for. Some we do know.
> That was what I was afraid of… I guess I’ll have to go back to guessing myself.
> I just wish I knew which ones {besides root} are too dangerous to add to regular
> user accounts. {sigh}

You could try the mail list folks :slight_smile:


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” (Minas Tirith))

Carlos E. R. wrote:
> On 2012-11-26 07:54, Vahis wrote:
>> nrickert wrote:
>
>>> I added myself to the “root” group, so that I can read
>>> “/var/log/messages” without being root.
>>>
>>
>> I wouldn’t do that.
>> Instead I would (I do) read logs being sudoer.
>
> Why not?
>

I try to follow the principle of least privilege and to belong to root
group for reading logs is not necessary.

Vahis

http://waxborg.servepics.com
openSUSE 11.4 (x86_64) 2.6.37.6-0.20-default main host
openSUSE 12.2 (x86_64) 3.6.7-12-desktop Tumbleweed in VirtualBox
openSUSE 12.2 (i586) 3.4.11-2.16-desktop in EeePC 900

Yet, with your plan, I would be root whenever I run “tail” - even on some of my own files.

That does not seem “least privilege” to me.

As best I can tell, root group membership does not confer any special privilege beyond the ability to read a few files (such as log files). It does not even give access to all log files.

nrickert wrote:
>
> Vahis;2506622 Wrote:
>> I try to follow the principle of least privilege and to belong to root
>> group for reading logs is not necessary.
>
> Yet, with your plan, I would be root whenever I run “tail” - even on
> some of my own files.

Yes, but only for doing exactly that and while it lasts.
Afterwards you’re plain user again.
>
> That does not seem “least privilege” to me.

To me it does.

If a particular task requires root powers, sudoing the command does not
elevate the privileges to do anything else, just that.

>
> As best I can tell, root group membership does not confer any special
> privilege beyond the ability to read a few files (such as log files).
> It does not even give access to all log files.

I have not experimented with the group thing so I’m not sure what can be
done with what particular files.

But I guess plain ‘sudo tail’ is less.

Vahis

http://waxborg.servepics.com
openSUSE 11.4 (x86_64) 2.6.37.6-0.20-default main host
openSUSE 12.2 (x86_64) 3.6.7-12-desktop Tumbleweed in VirtualBox
openSUSE 12.2 (i586) 3.4.11-2.16-desktop in EeePC 900

A compromise could be to alias “stail” to “sudo tail”? You can apply the same logic to many things then, smount, sumount and my personal favourite (in British English anyway), scat

On 2012-11-26 13:26, nrickert wrote:
>
> Vahis;2506622 Wrote:
>> I try to follow the principle of least privilege and to belong to root
>> group for reading logs is not necessary.
>
> Yet, with your plan, I would be root whenever I run “tail” - even on
> some of my own files.
>
> That does not seem “least privilege” to me.

I concur.

> As best I can tell, root group membership does not confer any special
> privilege beyond the ability to read a few files (such as log files).
> It does not even give access to all log files.

Just my thoughts. I can read some files without being root.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” (Minas Tirith))

Yes, I agree with that as a good compromise.