Rename a user / change username

From Andreida

Avoid to change the passwd directly. There might be problems in some cases.

Instead use:

usermod -l newname oldname

Rules:

  • start with a lowercase letter
  • only lowercase letters and digits
  • only use '-' as special character, but avoid it if you can

In case the user is using imap to access the mail server you will have to shut down the service temporarily I think.

/etc/init.d/dovecot stop
usermod -l newname oldname
/etc/init.d/dovecot start

(not sure yet if a reboot helps prevent problems)