Crostini is the Linux (LXD, a project initiated by Ubuntu publisher Canonical) container for ChromeOS. When enabled it creates a new container with the hostname "penguin" and an initial user whose user/login name is derived from the Gmail alias of the logged in Google account.
This is incovenient for a lot of reasons, not the least of which is that it makes working with NFSv3 shares and ssh keys on and for other hosts tedious (userids are everything to NFSv3, as login names are for ssh).
These are the steps to rename that default user and group:
In what follows "oldusername" is your existing username in penguin, while "newusername" is what you want it to be.
- Enter crosh with Ctrl-Alt-t
- Start terminal session with
vmc start termina
- Log into penguin container as root:
lxc exec penguin -- bash
- Run these commands:
killall -u oldusername
groupmod -n newusername oldusername
usermod -md /home/newusername -l newusername oldusername
usermod -aG users newusername
loginctl enable-linger newusername
- Shutdown the container:
shutdown -h now
- Close crosh and fire up the Linux console
The first time you do this it may crash (it did for me), but the second time it should open with your new username in the prompt.
Reference: https://www.reddit.com/r/Crostini/wiki/howto/change-default-username