A2oz

How to Change Username on Raspberry Pi?

Published in Operating Systems 2 mins read

You can change the username on your Raspberry Pi using the usermod command in the terminal.

Steps to Change Username on Raspberry Pi

  1. Log in as root: Use the command sudo su to gain root privileges.
  2. Change the username: Execute the command usermod -l <new_username> <old_username>, replacing <new_username> with your desired username and <old_username> with the current username.
  3. Update the password: If you wish to change the password for the new username, use the command passwd <new_username>.
  4. Log out and log back in: Once you've made the changes, log out of the current session and log back in using the new username.

Example:

To change the username from "pi" to "raspberry" and update the password, you would use the following commands:

sudo su
usermod -l raspberry pi
passwd raspberry

Remember to replace "raspberry" with your desired username.

Additional Tips

  • Back up your data: It's always a good idea to back up your Raspberry Pi before making any significant changes.
  • Check for dependencies: If you have any applications or scripts that rely on the old username, you may need to update their configurations.
  • Review system files: It's a good practice to review your system files and ensure that any references to the old username are updated.

Related Articles