Changing username

A pop-up appears when we boot up the DevTerm for the first time. It says we should change our username. That’s a wise suggestion but most guides instructing how to change one’s linux username say you should do this from the terminal while not logged in with that user. Sure enough trying to execute usermod in the terminal emulator doesn’t work. But there’s seemingly no way to boot the cpi OS i to a pure command line where i could sudo the cpi user into a name of my choice. Not anything straightforward anyway. So how are we expected to change our usernames exactly?

1 Like

devterm CM3 or A06?

I’ll describe how I in devterm A06
(on CM3 could be different):
The welcome message tells you to to change your password, not username.
There is no need to change the username other than you don’t want to be called cpi.

At default theuser is ‘cpi’, password is ‘cpi’ and has sudo powers.
root default password is not known to me (maybe not even defined).
First change your password:
passwd
(in applications → terminal emulator)
It will ask you once for your password and twice for your new password
Now set root password:
sudo passwd root
It will ask twice for new root password.

Ok, now log out.
right top corner, ‘cpi’, left click, select ‘log out’
login screen will appear.
at this point user cpi is not logged in and can be manipulated.
ALT + CTRL + F1
which on devterm keyboard is
ALT + CTRL + FN + 1
now you can log in text mode, enter username ‘root’ and the root password which you just created.
Entered password will not be visible. That’s normal.

Ok, now as root you can manipulate the user ‘cpi’.
In my case I changed the username to ‘b’.
usermod -l b cpi
It is possible that this will fail even though the user ‘cpi’ is not logged in, it will say that user is used [:)] by some process id.
you can kill the process manually, for example if it complains about process 2397 use
kill 2397
repeat until success, or kill all processes at once with pkill -u cpi
Now, finally, usermod -l b cpi should successfully change the name to ‘b’.
You would also want to change the user’s default group name
groupmod -n b cpi will change the group name from ‘cpi’ to ‘b’

You could also want to move your home directory.
I called my user ‘b’ so I want it to be at ‘/home/b’ not ‘/home/cpi
usermod -m -d /home/b b
will change the home directory of user ‘b’ to ‘/home/b’ preserving its contents.

If you stop at this point you could notice that the login screen, or the top bar will still refer tou you as ‘cpi’. That’s because those use the ‘full name’ which is still ‘cpi’.
The full name is not what’s typed at log in but what’s displayed at some places.
I wanted this to be ‘balt’.
So I
chfn -f balt b
which changes the full name of user ‘b’ to ‘balt’.

Ok, finished. now reboot.
reboot.

After restart you will see that your username, group name, full name, password are indeed changed.
But the difference is that this time it will ask you for password which it didn’t before.
This behavior is defined in
/etc/lightdm/lightdm.conf.d/12-autologin.conf
There you see:


[Seat:*]
autologin-user=cpi
autologin-user-timeout=0

Your user is no longer ‘cpi’ so the settings no longer apply. You could update the file or leave it unchanged depending on what you want.

If you moved your home directory, you will notice that in the file manager, in the ‘Places’ some shortcuts no longer work. They use old location. Update or remove them.

Instead of renaming the user you could also create a new one and remove ‘cpi’.

anyway, the only important part is changing the password.

5 Likes

For ClockworkOS, you won’t need to change your username to use your DevTerm. However, if you want (I certainly have), you can change it by following these steps:

  1. Log out of your current desktop session (Applications > Log Out — pressing the power button will also bring up the menu)
  2. Press the following keyboard combination: Fn + Ctrl + Alt + 1 (F1)
  3. Log in as root — the password is cpi
  4. Execute killall -u cpi to stop all processes under the user you want to rename
  5. Execute usermod -l newname -m -d /home/newname cpi to rename the user and move its home directory
  6. Execute groupmod -n newname cpi to move the user groups (including sudo access)
  7. Execute chfn -f "Your Name" newname to choose a new full name (shown top-right of the desktop session)
  8. Open up the LightDM config file for auto=login with nano /etc/lightdm/lightdm.conf.d/12-autologin.conf
  9. Change line 2 to be autologin-user=newname
  10. Press Ctrl + X, then Y, then Enter
  11. Execute reboot to restart the system

Your username should now have been changed! If you don’t want autologin, you can comment out all of the lines in 12-autologin.conf by prefixing them with the # symbol.

Hope this helps for people who want to rename their username! Other things you may want to do:

  • Change your password with passwd under your newly-renamed account
  • Change the hostname from clockworkpi-a06 by editing /etc/hostname (requires superuser privileges)
2 Likes

(There is nothing called “ClockworkOS” on the DevTerm)

Ahh, I mean the official OS that comes on the SD card included with the DevTerm A06 series! Isn’t ClockworkOS for GameShell? That’s probably where I got confused…

Actually, the wiki heavily suggests the name “ClockworkOS” for DevTerm:
https://wiki.clockworkpi.com/index.php/ClockworkOS
https://wiki.clockworkpi.com/index.php/Main_Page#Software_2

Well the wiki is community driven

1 Like