Anyone know how to change the default Raspberry Pi username "pi"?

I attempted to and ended up just removing the account and making a new one, but it messed up stuff causing things not to work the same so I had to reinstall the OS.

@glitcher32 usermod -m -d /home/[new username] -l [new username] pi

Run as root (i.e. logged out of the pi user), that should do it all in one command πŸ˜…

You'll probably also need to change the sudoers file:

export EDITOR=nano && sudo -E visudo

(replace anywhere it says pi in that file with the new username)

@jonah Just to sum it all up before I go all out messing things up.....
(Be logged out of pi account?)

Then I would type:
usermod -m -d /home/glitcher32 -l glitcher32 pi

(With "pi" at end of command)

Then type:
export EDITOR=nano && sudo -E visudo

(Then replace anything in there that says "pi" with "glitcher32")

@glitcher32 yeah so you're going to login as root (sudo su) first, then run those commands, which should theoretically change everything. Changing usernames isn't like, officially supported in Linux but most things are tied to the UID and the username is just for show so it should be fine.

Follow

@jonah After I run the first command (while logged into root) it goes through, but when I do that second command in and look in the file, there is nothing that says anything about "pi".

Do I have to log out of the root account then do it?

Β· Β· 0 Β· 0 Β· 0
Sign in to participate in the conversation
Mastodon πŸ” privacytools.io

Fast, secure and up-to-date instance. PrivacyTools provides knowledge and tools to protect your privacy against global mass surveillance.

Website: privacytools.io
Matrix Chat: chat.privacytools.io
Support us on OpenCollective, many contributions are tax deductible!