It is very tricky to rename an account while you are logged in to it, 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
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
To edit the “/etc/hosts” file, type:sudo nano /etc/hostsFind the line that reads:127.0.1.1 raspberrypiAnd change the word “raspberrypi” to the new name, e.g. “garypi” and exit nano with “Ctrl + x”.Reboot your Pi with “sudo reboot
” and check the name using the “hostname
” command.
No comments:
Post a Comment