Change Username

I have two identical old MacBook laptops recently converted from MacOS to Ubuntu 20.04 MATE. After getting one working well, a few months ago I copied the entire setup to the other and began using that as my primary laptop. Searching this Saturday for how to change the username on the one now containing ~3TB of my stuff, I found a brief tutorial.

My laptop has become an alien environment with my stuff and only some hints of my customized UI. What I know as MATE is gone. My impression is that MATE 20.04 may have differences from how username is changed in other Linux & Ubuntu environments and versions, because there's lots of variation in the HowTo pages I've found. It's also clear to me now that the name change process can be far more complex and fraught than portrayed on the site linked above. My most recent backup (both Backups & Timeshift apps) is a week or two old.

So two questions:

  1. Is there a way to fix the UI without risk of messing things up further?

  2. Can I at least return to the old username without getting even more lost?

What I did, as outlined on the site linked above:

sudo adduser tempuser
sudo usermod -aG sudo tempuser
sudo usermod -l newusername -d /home/newusername -m oldusername
sudo groupmod -n newusername oldusername
sudo ln -s /home/newusername /home/oldusername

My hope is that in fixing this, we may come up with a current and robust HowTo for anyone wanting to change username on MATE 20.04 or 20.10. Thanks in advance for any ideas, links or suggestions.

Quite agree. Never know what can go wrong. I wish things were simple and preferably using GUI.

Anyways,

Why did you have to create tempuser? and put him in sudo? I think these two steps are not needed. Or may be I missed something.

I changed my userrname on my pc recently and followed only steps 3 and 4. And then just did 'ls -la' on the home folder to make sure all permissions are OK and under my new username and groupname. Also, checked /etc/passwd and /etc/group for good measure. They will be updated with commands 3 and 4 but just to be sure. There was no issue.

I did not do step 5 either. Why is that needed? Will removing that link help?

If you can get screenshot of the UI it may help us understand better.

Not sure about reverting with backup though. If it is system back up (like timeshift) usually home folder is skipped. Will it revert user's home directory to old username? If it is only home folder backup using say dejadup, it will backup user's data but will it be able to restore when username has been changed? I honestly don't know. Somebody with experience with backups may be able to guide.

If you would like, you can run commands 3 and 4 (only) by reverting (swapping) newusername and oldusername.

1 Like

Thanks for the reply, saivinob! You've given me hope, and some ideas to contemplate. :slightly_smiling_face:

Interestingly, today I stumbled around the unfamiliar UI and found this in Settings/About:

OS Name Ubuntu 20.04.2 LTS
GNOME Version 3.36.8
Windowing System X11

Then in Settings/Users, a GUI for changing password, privileges, and username!
DOH! :anguished:
Maybe there's something like that in MATE I could've used!?

The instructions said you can't change a username while logged in.

The claim was that it's needed to mess with another user's account. I'm curious if the GUI can do it, but am quite reluctant to experiment with that. Certainly not before getting back to my prior username and extensive tweaks.

Can you hear the gnashing of my teeth? :grimacing:

It took some blindfolded rummaging to find the app I'd installed for that in MATE. Feast your eyes on this nearly un-customizable UI:

When initially greeted with black, I chose the solid blue BG so as to remember this is not currently my computer (plus I was probably feeling rather blue about that). Today I also populated the formerly 4-item list of unknowns in the Activities pop-down with apps I'm familiar with. I can't find anything that looks or functions remotely like MATE, or even a way to add a Panel or Plank. In case it helps, here's how it looks now when I click Activities:

My sense too. Just a new and larger can of worms perhaps.

I thought about that too, wondering if doing the same steps in reverse might put me back home in Oz (MATE). But the fear of course is descending another level into chaos.

It seems quite likely that any possible solution may need to be MATE specific, because it seems the computer is currently a GNOME (or is this X11?). Hopefully a certified MATE expert will take pity and offer suggestions. One thing I did today is back up through the Terminal buffer and copy each of my command lines into a text file. Shall I post that?

Maybe anything I do try would best be preceded by a complete backup?

Stupid me. Yes, I get it now. In my case, I had enabled root account previously. So I had logged in directly as root to execute steps 3 and 4. Sorry about that.

Since nobody else has commented on my mess or your many helpful replies saivinob, I'm now in the process of backing up what I hope is the correct data partition. Then I'm going to run Timeshift on what still seems to be the root partition (glad I partitioned the drive!). Then I'll try the idea of reversing the CLI commands that I foolishly used to hose up a nice MATE environment.

If that works, I'll try changing the username via MATE's cool little System Settings / Users and Groups / Users Settings GUI. While waiting to see if you or anyone else offered further input, I realized the MacBook used for initial setup that I'd copied to this active MacBook and then added many further tweaks plus my data, still has MATE running fine. So today I checked and easily found that GUI username change option. It seems likely that will work fine, but can post a followup regardless.

I gave up on figuring this out or using Timeshift, and simply booted from an Ubu/M install microSD in a USB3 adapter and used Gparted to copy my latest install and paste it into the internal root/boot partition. Didn't take very long, kept all my data in the (thankfully) separate home partition, and I was happy to see that all my Panel and other customizations were intact because they're stored in the home partition. :slight_smile:

I find Timshift to be confusing and annoying, so although it takes longer to do a complete copy/paste in Gparted than an incremental backup in Timeshift, I may just shift to using Gparted from now on. I didn't find a way to look at the Timeshift incrementals to see what they contain, and was glad that's easy in a file browser (and that I had a recent backup with nothing significant new done since, due to the laptop being so hosed up). Feels a bit cowardly to give up on finding and fixing the actual issue, but sometimes you gotta "know when to fold 'em." Just seemed far beyond my capabilities, despite all the helpful pointers. So thanks guys, for your kindness to a newbie. :slightly_smiling_face:

Oh yeah, as for changing the username I used System Settings -> Users and Groups (Users Settings). Next to the top line I clicked Change and typed in a more descriptive username. Quick, simple (and thankfully non-destructive), though it apparently didn't really change much. I'm going to ignore the home directory name and just carry on enjoying Ubu-M on my laptop. :slightly_smiling_face: