# Changing userid



## rbizzell33 (Apr 12, 2010)

I have a user that has the correct uid number in the passwd but she can't access herhome directory which has her email there. I am using Maildir folder. The enduser owns the directory but when yo uls- lha the first column shows her username but the second column shows the wheel group instead of her userid which should be 1571. I can I change her user id because she can't login and access her mail. I am running postfix and courier-imap


----------



## graudeejs (Apr 12, 2010)

create new user with id you want, delete old user


----------



## rbizzell33 (Apr 12, 2010)

*Change user id*

What about her home directory. I want to keep that


----------



## DutchDaemon (Apr 12, 2010)

chgrp(1) ->


```
The group operand can be either a group name from the group database, or
     a numeric group ID.  If a group name is also a numeric group ID, the op-
     erand is used as a group name.
```


----------



## SirDice (Apr 12, 2010)

`# chown -R username:prim_group /usr/home/username`


----------



## rbizzell33 (Apr 12, 2010)

Do I put the user id number in the command that I am issuing chown -r username: the id number


----------



## SirDice (Apr 12, 2010)

rbizzell33 said:
			
		

> Do I put the user id number in the command that I am issuing chown -r username: the id number



If she has a proper user and group name use that.


----------



## rbizzell33 (Apr 12, 2010)

The user id is wrong and even when I changed it manually ins passwd and gave ownership to her home directory. She still couldn't access it. Her userid is different because I created a new account for her.


----------



## rbizzell33 (Apr 12, 2010)

her group id and uid is the same the uid is correct but the group id says wheel and it should show the same id that it shows for uid


----------



## SirDice (Apr 12, 2010)

Please post the relevant parts of /etc/passwd, /etc/group and [cmd=]ls -dl /usr/home/username[/cmd] because I'm lost. I have no idea what you did or what you're trying to do.

A [cmd=]id -a username[/cmd] would be handy too.


----------



## graudeejs (Apr 12, 2010)

aren't /etc/passwd also kept in some sort of database? [same way /etc/login.conf is]?
If so it needs to be updated


----------



## rbizzell33 (Apr 12, 2010)

when I issue the command ls -dl /home/username ghenry ghenry. When I issue that same command on a user that can access their home directory is shows username and next to that is shows their id number

```
drwx------  3 ghenry  ghenry  512 Dec 18 11:43 /home/ghenry
```
this is the enduser that has the problem

```
drwxr-xr-x  6 rbizzell  1001  512 Nov 20  2006 /home/rbizzell
```
This is the enduser that doesn't have a problem


----------



## rbizzell33 (Apr 12, 2010)

when I telnet using imap and try to login it says the account mailbox is not owned by the correct uid or guid


----------



## rbizzell33 (Apr 12, 2010)

I am logging in with that users credentials and that is the error


----------



## SirDice (Apr 12, 2010)

Your group memberships are all screwed up. You should _not_ see numeric group ids. At all.


----------



## jea (Feb 14, 2018)

For future visitors, you can also try pw(8) for changing uid and name. For example:

`pw usermod -n olduid -u newid
pw usermod -n oldname -l newname`


----------

