# Remove user from wheel who was added during install FreeBSD.



## bryn1u (Mar 26, 2011)

Hello.

I can't find solutions, how can I remove a user from /etc/group who I added during installing FreeBSD? It shows me that I'm in the wheel group but I don't see it in /etc/group. How can I find and remove this user from wheel? Google says not too much.

Greet.


----------



## Pushrod (Mar 26, 2011)

If the user's default group is wheel, then you must make a new group and and change their GID with chsh.


----------



## bryn1u (Mar 26, 2011)

Can't I remove only that user from this group? Is it necessary to make a new group and change GID?


----------



## da1 (Mar 26, 2011)

Yes you can. One way of doing it is by editing the /etc/group file and removing the user from the group you want. 
Another way is by using: [CMD=""]pw usermod <username> -g <group_name>[/CMD]

PS: I hope we're not talking about the root user here


----------



## bryn1u (Mar 26, 2011)

Heh. Not talking about root. I do not even mean it mate. The first way is impossible, because when you choose your user during the installation of FreeBSD you will not see him in /etc/group. So that's why I will try to use the second way. Thanks for help.


----------



## da1 (Mar 26, 2011)

bryn1u said:
			
		

> u will not see him in /etc/group.



Of course not. /etc/group is for groups just like /etc/master.passwd is for users .


----------



## bryn1u (Mar 26, 2011)

I mean that if you write to wheel group user after installation of FreeBSD you will see him in /etc/group (wheel:user,user1,user2 etc...) But during installation it will ask do you want to add a new user or group. After this options when you want to see /etc/group for wheel user you will see nothing. Only empty wheel: But checking my id I'm in the wheel group. Why?


----------



## da1 (Mar 27, 2011)

Hmm ... you're right, I just replicated this behavior. I don't know what to tell you really ....


----------



## sossego (Mar 27, 2011)

What happens if you use vi to edit the user from wheel in /etc/group?


----------



## tyson (Mar 27, 2011)

But answer is in second post in this topic.


----------



## phoenix (Mar 27, 2011)

There are two sets of groups:  Primary Groups, and Secondary Groups.

Primary Group IDs are set in /etc/passwd.  The format for passwd entries is:

```
cups:*:193:[b]193[/b]:CUPS Owner:/nonexistent:/usr/sbin/nologin
username:password:user ID:[b]primary group ID[/b]:long name:home directory:shell
```

When you add a user to the end of the line in /etc/group, that's adding a Secondary Group ID to the user.

No idea how you have managed to set the Primary Group ID of a user to 0.  I've never seen that happen, and every single one of my FreeBSD installs includes my user as part of groups "fcash", "wheel", and "operator".  And wheel/operator is set as secondary group automatically.

When you use commands like id() or groups() you get the combination of Primary Group and all Secondary Groups.


----------



## hipodilski (Apr 4, 2012)

If I understand your question right you should use:
`pw groupmod wheel -d username`

For a bit more thorough info on the topic check out
http://www.pc-freak.net/blog/how-to-delete-user-belonging-to-a-group-on-freebsd-the-bsd-proper-way/

best


----------

