Jump to content

User renaming

From UNIX.dog Wiki

User renaming

To rename a user, the corresponding LDAP entry must be modified.

Caveats

  • There is no way to rename an XMPP user, so all contacts there will be lost unless notified of the change before.

Process

  1. Use an LDAP editor to modify the LDAP entry under ou=Dogs,dc=unix,dc=dog.
dn: cn=oldname,ou=Dogs,dc=unix,dc=dog
changetype: moddn
newrdn: cn=newname
deleteoldrdn: 1

dn: cn=newname,ou=Dogs,dc=unix,dc=dog
changetype: modify
replace: homeDirectory
homeDirectory: /home/newname
-
replace: uid
uid: newname
-
replace: mail
mail: newname@unix.dog

2. umount old home directory from bind mounts

umount /usr/local/bastille/jails/caddy/root/srv/public/oldname
umount /usr/local/bastille/jails/website/root/srv/public/oldname
umount /srv/gemini/users/oldname

3. Rename ZFS dataset

zfs rename tank/home/oldname tank/home/newname
ln -s newname /home/oldname

4. Move vmail folder

mv /usr/local/bastille/jails/imap/root/var/vmail/{oldname,newname}

5. Add SMTP alias

# In `smtp` jail

echo "oldname: newname" >> /etc/mail/aliases
echo "newname  newname newname@unix.dog oldname oldname@unix.dog" >> /usr/local/etc/postfix/local_senders
postmap /etc/mail/aliases
postmap /usr/local/etc/postfix/local_senders

6. Update Forgejo user (seems to need deletion and recreation?)