usermod -l newusername oldusername
groupmod -n newusername oldusername
- When trying to do this over ssh, you will need to be logged in as root. Refere to SSH Tips for instructions on how to ssh as root.
- This does not automatically change the users home directory to the new username. See below on how to do that.
usermod -m -d /home/new-directory username
- You will most likely want to set new-directory to be the username but it can be nearly anything.