Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

When I run the the following command in a terminal I get different output. I try to find out if I am a member of the Wireshark group.

groups $USER

Does list wireshark

groups

Does not list wireshark

So do I belong to the Wireshark group or not?

share|improve this question
add comment

3 Answers 3

up vote 4 down vote accepted

You haven't restarted per the instructions on that answer.

  • groups is shows groups as currently applied to your user
  • groups $USER is asking the system to calculate the groups for that user.

This isn't a case of "trusting" one over the other. They show pointedly different things.

Groups are applied to a user when they log in. That's why my instructions are to restart or log out then in again. This makes the system apply the new group and thus allows you to use Wireshark.

share|improve this answer
    
Thx, I did log out. Tried it twice. But now after a restart it works. It actually broke after updating to 14.04. I probably forgot to add myself to the Wireshark group again, after reconfiguring sudo dpkg-reconfigure wireshark-common – –  Janghou May 1 at 13:33
add comment

From man groups:

Print group memberships for each USERNAME or, if no USERNAME is specified, for the current process (which may differ if the groups database has changed).

I'd trust groups $USER as your current process can return different values.

share|improve this answer
add comment

groups command gives current logged in users groups in which that user belongs.

& groups username allows to view groups in which username belongs to.

Try with your current username,

This is mine:

username@host:~$ groups

username adm cdrom sudo dip plugdev lpadmin sambashare

username@host:~$ groups username

username : username adm cdrom sudo dip plugdev lpadmin sambashare

Check with any command for whether you belong to wireshark or not.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.