Take the 2-minute tour ×
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It's 100% free, no registration required.

I know that security by obscurity is not real security, however, why make it easy by keeping a well known username such as "pi".

Therefore, what are the implications to changing the username of "pi" on Raspbian and Raspbmc?

Do I need to do anything other than just editing /etc/password changing "pi" to some new string?

Researching on how to force sudo to require a password I discovered that /etc/sudoers on my Raspbmc contains an entry for "pi", so therefore I at least need to update that file accordingly.

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

Changing the user login name should work. It's just a piece of text for people to use. UID is the thing that actually identifies a user to the system. Some config files can indeed be using the name and of course the user has a home dir etc.

You shouldn't edit passwd file by hand, but by tools like vipw or usermod. Remember that there's probably a shadow system as well, so you need to make sure they're both updated properly.

I wouldn't try to rename a user but create a new one and either disable or remove the default account. Removing it risks a new user with the same uid (getting same file access etc) or login name (e.g. sudo rights) getting added later.

share|improve this answer
1  
Thanks for your advice. I am going to create a new account and then lock the default account using passwd -l. Since I'm currently using Raspbmc this should allow the xbmc background daemons run using the default account. –  HeatfanJohn Nov 3 '12 at 23:01
add comment

It is tricky to rename an account while you are logged in to it, and easy to accidentally lock yourself out of your Pi, so first enable the root account with

$ sudo passwd root

Use a secure password, even if you intend to lock the root account again later. Then log out and log back in as root. The rest supposes a desired username of "myuname" - replace with whatever you want.

# usermod -l myuname pi
# usermod -m -d /home/myuname myuname
# groupmod -n myuname pi

This first renames the account and then moves the home directory associated with it. Then log out and log back in again as "myuname". If you are still using the default password of "raspberry" on this account, do

$ passwd

and change password to something more secure. That should be it. Test carefully! "sudo" users seem to get updated OK, but check that your renamed account works and really does have "sudo" privileges before disabling the root account.

Should you prefer to disable the root account, do

$ sudo passwd -l root

Technically, this just locks the password - it doesn't completely disable the account. But that's probably what you want.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.