computer name

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
pylon
Level 1
Level 1
Posts: 1
Joined: Fri Jul 13, 2018 7:22 pm

computer name

Post by pylon » Fri Jul 13, 2018 7:27 pm

ok, i am trying to change the home/user directory name and the name that shows up in terminal i.e user@computername. the user part. I inherited this computer from my mom and since she passed its hard to see her name on the computer sometimes. i don't know when it will strike the sadness but i'd like to try and eliminate the chance. if it can't be done without a clean install thats fine too, just thought id ask.

User avatar
catweazel
Level 19
Level 19
Posts: 9521
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: computer name

Post by catweazel » Fri Jul 13, 2018 9:24 pm

pylon wrote:
Fri Jul 13, 2018 7:27 pm
ok, i am trying to change the home/user directory name and the name that shows up in terminal i.e user@computername. the user part. I inherited this computer from my mom and since she passed its hard to see her name on the computer sometimes. i don't know when it will strike the sadness but i'd like to try and eliminate the chance. if it can't be done without a clean install thats fine too, just thought id ask.
You don't say what version or edition of Mint you're using, so, generally, you create a new admin user, test that the new account works as an admin user, then delete the other user, followed by, presumably, deleting their /home/username directory.
¡uʍop ǝpısdn sı buıɥʇʎɹǝʌǝ os ɐıןɐɹʇsnɐ ɯoɹɟ ɯ,ı

gm10
Level 19
Level 19
Posts: 9243
Joined: Thu Jun 21, 2018 5:11 pm

Re: computer name

Post by gm10 » Sat Jul 14, 2018 4:45 am

^ he didn't ask to create a new user, he just asked to change the existing one.

Renaming a user is fairly simple. I created a little script for that:

Code: Select all

killall -u $1
sudo usermod -md /home/$2 -l $2 $1
sudo groupmod -n $2 $1
sudo chfn -f $2 $2
Copy & paste that into a document and save as rename_user.sh in your home folder. Now open a terminal an run

Code: Select all

sudo chmod +x rename_user.sh
Now I'm assuming you only got a single user account on that system. We'll need a second one. Find 'Users and Groups' in your menu - or whatever the equivalent in your Mint edition - and create a new user called sudo. Give it a simple password and click ok.

Next you'll need to log out of your user account. Once you're at the login screen, press Ctrl+Alt+F1 and log in with the user name sudo and the password you set for it. Then type

Code: Select all

/home/OLDUSERNAME/rename_user.sh OLDUSERNAME NEWUSERNAME
with OLDUSERNAME being your late mom's user name as it was showing up in the terminal, and NEWUSERNAME being the new user name you want for yourself.

Finally type exit followed by Alt+F7 and you'll be back at the login screen. Wait for it to show your new user name and then you can log in with it. Note that if your displayed user name wasn't equal to OLDUSERNAME then it wouldn't have been changed by my script (you would have gotten an error message running the script, ignore it). You can change it later via the GUI tool that you used above to create the new user.

I suggest to now delete the sudo user again via the UI tool you used to create it.

Note that since the path to your home folder changed, any settings or link that pointed directly to the old path would not find that path anymore. Typically variables are used to make such things relative to your user name though.
Last edited by gm10 on Sat Jul 14, 2018 6:28 am, edited 2 times in total.
Tune up your LM 19.x: ppa:gm10/linuxmint-tools

User avatar
catweazel
Level 19
Level 19
Posts: 9521
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: computer name

Post by catweazel » Sat Jul 14, 2018 4:47 am

gm10 wrote:
Sat Jul 14, 2018 4:45 am
^ he didn't ask to create a new user, he just asked to change the existing one.
I know. I proposed what I took to be the least risky route.
¡uʍop ǝpısdn sı buıɥʇʎɹǝʌǝ os ɐıןɐɹʇsnɐ ɯoɹɟ ɯ,ı

gm10
Level 19
Level 19
Posts: 9243
Joined: Thu Jun 21, 2018 5:11 pm

Re: computer name

Post by gm10 » Sat Jul 14, 2018 4:48 am

catweazel wrote:
Sat Jul 14, 2018 4:47 am
gm10 wrote:
Sat Jul 14, 2018 4:45 am
^ he didn't ask to create a new user, he just asked to change the existing one.
I know. I proposed what I took to be the least risky route.
Least risky? You didn't even tell him to move his files and settings over. Following your instructions he'd have lost everything. :shock:
Tune up your LM 19.x: ppa:gm10/linuxmint-tools

User avatar
BG405
Level 7
Level 7
Posts: 1884
Joined: Fri Mar 11, 2016 3:09 pm
Location: England

Re: computer name

Post by BG405 » Sat Jul 14, 2018 4:25 pm

gm10 wrote:
Sat Jul 14, 2018 4:48 am
tell him to move his files and settings over
True, but:
pylon wrote:
Fri Jul 13, 2018 7:27 pm
if it can't be done without a clean install thats fine too
No mention was made (by the OP) of wanting to save anything from the old configuration, it's probably best to make a backup of the old /home or some of the files in it if they are important, but i read it that the OP just wants to replace Mum's account. Afraid I've been there, too. :(
Dell Inspiron 1525 - LM17.3 CE 64-------------------Lenovo T440 4GB - Manjaro KDE, LM17.3 KDE 32
Toshiba NB250 - Manjaro KDE------------------------K7S5A AMD 1.2GHz - LM17.3 Xfce 32 & WinXP-Pro
Acer Aspire E11 ES1-111M - LM18.2 KDE 64 ----Dell PII 350 64MB - Puppy 4.3 & Win98-SE

gm10
Level 19
Level 19
Posts: 9243
Joined: Thu Jun 21, 2018 5:11 pm

Re: computer name

Post by gm10 » Sat Jul 14, 2018 4:32 pm

BG405 wrote:
Sat Jul 14, 2018 4:25 pm
No mention was made (by the OP) of wanting to save anything from the old configuration, it's probably best to make a backup of the old /home or some of the files in it if they are important, but i read it that the OP just wants to replace Mum's account. Afraid I've been there, too. :(
Clean install was his fall-back option, and in any case I always like to assume that users asking for help generally don't always know exactly what they should be asking for so I don't like to suggest destructive solutions where they can be avoided.

And I've not been there yet, luckily. My mother's only problem after I clean installed her to Mint 19 was the new default wallpaper design, she found that very confusing and wanted the old design back. ;)
Tune up your LM 19.x: ppa:gm10/linuxmint-tools

User avatar
AZgl1500
Level 11
Level 11
Posts: 3534
Joined: Thu Dec 31, 2015 3:20 am
Location: Oklahoma where the wind comes sweeping down the plains
Contact:

Re: computer name

Post by AZgl1500 » Sat Jul 14, 2018 5:00 pm

I once made a huge mistake of not painstakingly asking what the user wanted to keep.
"oh nothing much", and of course, Windows has everything in "My Documents" and the user thought that would "always be there".


Oops! as we all know, Microsoft has from day one, been extremely negligent is saving the old "My Documents" folder with a new install... they just blithely wipe the disk and start over.

Never made that mistake again, always did a full copy of their disk to a backup HDD, that way, even if they store something in a very arcane place, you can find it with a search tool.

User avatar
majpooper
Level 5
Level 5
Posts: 941
Joined: Thu May 09, 2013 1:56 pm
Location: North Carolina, USA

Re: computer name

Post by majpooper » Sat Jul 14, 2018 9:38 pm

Hi Pylon,
Your question seems innocent enough and actually there are commands to accomplish what you ask. Unfortunately it is what is unsaid that is a potential mine field - i.e. how is this machine configured, what do you want to save and so on - and things I and others are not even thinking of. Sure a very experienced person could do this and as things broke could trouble shoot them and fix them on the fly. So it is probably not a good idea to attempt to change a user's name. In short it can cause a ton of problems because for one thing the user name is referenced in configuration files in the form of the user's home directory, /home/<username>. I think it would be best to just create a new username and then migrate the old username files and data over to the new account.

HaveaMint
Level 5
Level 5
Posts: 696
Joined: Fri Feb 02, 2018 9:56 pm
Location: Somewhere in the USA
Contact:

Re: computer name

Post by HaveaMint » Sat Jul 14, 2018 10:30 pm

majpooper wrote:
Sat Jul 14, 2018 9:38 pm
Hi Pylon,
Your question seems innocent enough and actually there are commands to accomplish what you ask. Unfortunately it is what is unsaid that is a potential mine field - i.e. how is this machine configured, what do you want to save and so on - and things I and others are not even thinking of. Sure a very experienced person could do this and as things broke could trouble shoot them and fix them on the fly. So it is probably not a good idea to attempt to change a user's name. In short it can cause a ton of problems because for one thing the user name is referenced in configuration files in the form of the user's home directory, /home/<username>. I think it would be best to just create a new username and then migrate the old username files and data over to the new account.
What he said PLUS make sure to give your new username Root Privileges (Administrative).
"Tune for maximum Smoke and then read the Instructions".

User avatar
lsemmens
Level 8
Level 8
Posts: 2448
Joined: Wed Sep 10, 2014 9:07 pm
Location: Rural South Australia

Re: computer name

Post by lsemmens » Sat Jul 14, 2018 10:39 pm

Another problem with the "windows way" is that not all data is stored in My Documents. E-mails being the stand out. It's always worth doing a full backup before starting again, just in case.
Kernel: 4.15.0-46-generic x86_64 bits
Desktop: Cinnamon 3.8.9
Distro: Linux Mint 19 Tara

Laptop HP-ProBook-470-G2 8Gb RAM SSD
Server AMD Phenom 9650 - GEForce 9400GT 6Gb RAM
+ three other Mint machines
Out of my mind - please leave a message

User avatar
AZgl1500
Level 11
Level 11
Posts: 3534
Joined: Thu Dec 31, 2015 3:20 am
Location: Oklahoma where the wind comes sweeping down the plains
Contact:

Re: computer name

Post by AZgl1500 » Sat Jul 14, 2018 10:43 pm

lsemmens wrote:
Sat Jul 14, 2018 10:39 pm
Another problem with the "windows way" is that not all data is stored in My Documents. E-mails being the stand out. It's always worth doing a full backup before starting again, just in case.
and MS Word's macro library, which I have a lot of special one of a kind made up by me for special purposes.....
I once about 10 years ago, right after being clobbered by the big yellow truck in my Avatar,
did a new install to clean up a badly mangled Registry.....
I had a short fuse then, and just decided THWI and just wiped the disk clean and only saved my c:/DATA folder and c:/INSTALLS folder.

no thought as to where my MSWord/macros were stored......
years worth of macro design down the drain.

that yeller Penske truck did me in right properly...

User avatar
lsemmens
Level 8
Level 8
Posts: 2448
Joined: Wed Sep 10, 2014 9:07 pm
Location: Rural South Australia

Re: computer name

Post by lsemmens » Sat Jul 14, 2018 11:23 pm

AZgl1500 wrote:
Sat Jul 14, 2018 10:43 pm

no thought as to where my MSWord/macros were stored......
years worth of macro design down the drain.

that yeller Penske truck did me in right properly...
I know the problem well! M$ macros and VBA was what kept me away from Open Office for soooooo long. Our stories sound similar. I was cleaned up by a F100 doing 100Kph (60MPH) whilst stationary at a Police road block!.
Kernel: 4.15.0-46-generic x86_64 bits
Desktop: Cinnamon 3.8.9
Distro: Linux Mint 19 Tara

Laptop HP-ProBook-470-G2 8Gb RAM SSD
Server AMD Phenom 9650 - GEForce 9400GT 6Gb RAM
+ three other Mint machines
Out of my mind - please leave a message

User avatar
majpooper
Level 5
Level 5
Posts: 941
Joined: Thu May 09, 2013 1:56 pm
Location: North Carolina, USA

Re: computer name

Post by majpooper » Sun Jul 15, 2018 4:43 pm

You know - thinking about this a little more . . . . I would say backup all your data and do a fresh install. No particular heavy duty skill set needed just standard backup and reinstall tasks that are easily accomplished and documented. And if you need help folks can walk you through this a lot more easily and safer. The key of course is backing up critical data - but that should go without saying.

User avatar
majpooper
Level 5
Level 5
Posts: 941
Joined: Thu May 09, 2013 1:56 pm
Location: North Carolina, USA

Re: computer name

Post by majpooper » Sun Jul 15, 2018 4:44 pm

You know - thinking about this a little more . . . . I would say backup all your data and do a fresh install. No particular heavy duty skill set needed just standard backup and reinstall tasks that are easily accomplished and documented. And if you need help folks can walk you through this a lot more easily and safer. The key of course is backing up critical data - but that should go without saying.

all41
Level 15
Level 15
Posts: 5670
Joined: Tue Dec 31, 2013 9:12 am
Location: Computer, Car, Cage

Re: computer name

Post by all41 » Sun Jul 15, 2018 9:16 pm

gm10 wrote:
Sat Jul 14, 2018 4:48 am
catweazel wrote:
Sat Jul 14, 2018 4:47 am
gm10 wrote:
Sat Jul 14, 2018 4:45 am
^ he didn't ask to create a new user, he just asked to change the existing one.
I know. I proposed what I took to be the least risky route.
Least risky? You didn't even tell him to move his files and settings over. Following your instructions he'd have lost everything. :shock:
This could have been handled in a much more gentlemanly manner.

Sometimes just sending a friendly pm informing a member of errant information, thus allowing them an oppurtunity to reflect and correct is a better scenario.

But thumbs down to calling out, and publically embarrassing an outstanding volunteer contributor to this forum.

gm10
Level 19
Level 19
Posts: 9243
Joined: Thu Jun 21, 2018 5:11 pm

Re: computer name

Post by gm10 » Sun Jul 15, 2018 10:24 pm

all41 wrote:
Sun Jul 15, 2018 9:16 pm
This could have been handled in a much more gentlemanly manner.

Sometimes just sending a friendly pm informing a member of errant information, thus allowing them an oppurtunity to reflect and correct is a better scenario.

But thumbs down to calling out, and publically embarrassing an outstanding volunteer contributor to this forum.
You can always be friendlier but let's not get holier than thou now, my post was in response to the guy who likes to respond to posts with "Nonsense" without further qualification. So I'm sure he took it as the offhand comment it was and not as an attempt to embarrass him. Besides, there was nothing errant about his information, either, the procedure he described was entirely correct, just didn't specifically point out to backup data. Without him later qualifying it as "safer" I would never even have commented on that bit. It's unfortunate he wants to call it quits but that was certainly a long build-up and not this particular circumstance.
Tune up your LM 19.x: ppa:gm10/linuxmint-tools

all41
Level 15
Level 15
Posts: 5670
Joined: Tue Dec 31, 2013 9:12 am
Location: Computer, Car, Cage

Re: computer name

Post by all41 » Sun Jul 15, 2018 10:30 pm

Sorry--I have a different viewpoint

gm10
Level 19
Level 19
Posts: 9243
Joined: Thu Jun 21, 2018 5:11 pm

Re: computer name

Post by gm10 » Sun Jul 15, 2018 10:50 pm

all41 wrote:
Sun Jul 15, 2018 10:30 pm
Sorry--I have a different viewpoint
That's ok. I'll note your hypocrisy though for publicly calling me out. ;)
Tune up your LM 19.x: ppa:gm10/linuxmint-tools

all41
Level 15
Level 15
Posts: 5670
Joined: Tue Dec 31, 2013 9:12 am
Location: Computer, Car, Cage

Re: computer name

Post by all41 » Sun Jul 15, 2018 10:59 pm

Certainly, we are all called together, and that is good medicine.

In this instance a sincere offer of a handshake would go far

Post Reply

Return to “Newbie Questions”