[solved] Change my username on cloned system

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
Pepper-Mint-Patty
Level 4
Level 4
Posts: 370
Joined: Fri Dec 20, 2019 4:54 pm

Re: Change my username on cloned system

Post by Pepper-Mint-Patty »

hayden wrote:
Mon Oct 12, 2020 7:17 am
Something I forgot to mention, you need to do my method as another user (not logged in to the user you want to change the username). or when at the log in sceen, press Ctrl + Alt + F1. This will change to a virtual console where you can log in to a different user that has sudo privileges or just log in as root.
Ok i have just figured out i had to make a 2nd user. I understand you have 4 users in your example. Could you please tell how to make a 2nd user?
Language is a virus _ . _ . _ . _ . _ . _ . _ . _ . _ . _ 19.2 Cinn + 4.15-91 + Nemo 4.2.3
hayden
Level 2
Level 2
Posts: 72
Joined: Thu Apr 07, 2011 7:59 am
Location: Texas, USA

Re: Change my username on cloned system

Post by hayden »

[/quote]
@reorx said
@hayden method seems concise and what I have used from root shell. Confused somewhat regarding the shadow file changes
though. Is the shadow file written at boot?
Hello. It might in fact be. If there are any issues logging in, one would just need to reset the user's password. Easy fix, however. As root, running "passwd test3 and then resetting the password will fix that.


@Pepper-Mint-Patty
Have you ever logged in as root before? or only used sudo? Might be a good idea to either create another user and make sure they're sudo privileges are working or log in as root in a virtual console to do my steps, as I mentioned in one of the above posts.
Pepper-Mint-Patty
Level 4
Level 4
Posts: 370
Joined: Fri Dec 20, 2019 4:54 pm

Re: Change my username on cloned system

Post by Pepper-Mint-Patty »

i always use sudo.
Language is a virus _ . _ . _ . _ . _ . _ . _ . _ . _ . _ 19.2 Cinn + 4.15-91 + Nemo 4.2.3
hayden
Level 2
Level 2
Posts: 72
Joined: Thu Apr 07, 2011 7:59 am
Location: Texas, USA

Re: Change my username on cloned system

Post by hayden »

Pepper-Mint-Patty wrote:
Mon Oct 12, 2020 7:23 am
Ok i have just figured out i had to make a 2nd user. I understand you have 4 users in your example. Could you please tell how to make a 2nd user?
Hello. You can add a user with either the Linux Mint built-in GUI tool by searching for "user" in the menu, or in the terminal with:

Code: Select all

erik@ipa:~$ sudo adduser test4
Whichever you feel more comfortable with.
After you created your user make sure sudo privaleges are working if you are going to use sudo with that new user. Otherwise set a root password and use the root account directly versus using sudo.
Pepper-Mint-Patty
Level 4
Level 4
Posts: 370
Joined: Fri Dec 20, 2019 4:54 pm

Re: Change my username on cloned system

Post by Pepper-Mint-Patty »

ok having 2 users: old + new

Code: Select all

old@old:~$ cd /home && ls
old new lost+found
whats that 'lost+found' ?

I am logged in under old. Now i can follow procedure above?

I guess a need a 3rd user! and run changes from usernames old to new from that one?!
Language is a virus _ . _ . _ . _ . _ . _ . _ . _ . _ . _ 19.2 Cinn + 4.15-91 + Nemo 4.2.3
Pepper-Mint-Patty
Level 4
Level 4
Posts: 370
Joined: Fri Dec 20, 2019 4:54 pm

Re: Change my username on cloned system

Post by Pepper-Mint-Patty »

ok i might need only 2 users: OLD + TEMP. Log in under TEMP. Change OLD into NEW. ?
Language is a virus _ . _ . _ . _ . _ . _ . _ . _ . _ . _ 19.2 Cinn + 4.15-91 + Nemo 4.2.3
Pepper-Mint-Patty
Level 4
Level 4
Posts: 370
Joined: Fri Dec 20, 2019 4:54 pm

Re: Change my username on cloned system

Post by Pepper-Mint-Patty »

i have changed in Xed all test2 and test3 in the given codes in appropiate names (replace all method)

Now just paste the renamed codes in terminal starting with sudo here?

Code: Select all

 test2:x:1004:1004:test2,,,:/home/test2:/bin/bash
Language is a virus _ . _ . _ . _ . _ . _ . _ . _ . _ . _ 19.2 Cinn + 4.15-91 + Nemo 4.2.3
hayden
Level 2
Level 2
Posts: 72
Joined: Thu Apr 07, 2011 7:59 am
Location: Texas, USA

Re: Change my username on cloned system

Post by hayden »

whats that 'lost+found' ?
https://www.wikitechy.com/technology/pu ... inux-unix/
I am logged in under old. Now i can follow procedure above?
Edit: No, you cant login to the desktop with your old username. You need either be logged in to a new user account or in a virtual terminal as root.
I guess a need a 3rd user! and run changes from usernames old to new from that one?!
Just need need another user other than the one you're trying to change. You can do this is as root as well, that way you don't have to create a separate user. But creating a separate user with sudo access works too.
Last edited by hayden on Mon Oct 12, 2020 10:35 am, edited 1 time in total.
hayden
Level 2
Level 2
Posts: 72
Joined: Thu Apr 07, 2011 7:59 am
Location: Texas, USA

Re: Change my username on cloned system

Post by hayden »

Pepper-Mint-Patty wrote:
Mon Oct 12, 2020 8:41 am
ok i might need only 2 users: OLD + TEMP. Log in under TEMP. Change OLD into NEW. ?
Yes just 1 other user. Yes.
hayden
Level 2
Level 2
Posts: 72
Joined: Thu Apr 07, 2011 7:59 am
Location: Texas, USA

Re: Change my username on cloned system

Post by hayden »

Pepper-Mint-Patty wrote:
Mon Oct 12, 2020 8:55 am
i have changed in Xed all test2 and test3 in the given codes in appropiate names (replace all method)

Now just paste the renamed codes in terminal starting with sudo here?

Code: Select all

 test2:x:1004:1004:test2,,,:/home/test2:/bin/bash
No, the

Code: Select all

test2:x:1004:1004:test2,,,:/home/test2:/bin/bash
is not a command to run. This is a line in the file that needs to be edited. See my initial instruction about editing the files.
User avatar
Flemur
Level 18
Level 18
Posts: 8730
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: Change my username on cloned system

Post by Flemur »

Code: Select all

username -l NEW_LOGIN
-l, --login NEW_LOGIN
The name of the user will be changed from LOGIN to NEW_LOGIN. Nothing else is changed.
In particular, the user's home directory or mail spool should probably be renamed
manually to reflect the new login name.
Watch out for adding a new user because file access is based on UID and the first username gets UID 1000, then adding new users you get 1001, 1002, etc. IOW, a new user won't be able to access the old user's files without some fiddling.
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
hayden
Level 2
Level 2
Posts: 72
Joined: Thu Apr 07, 2011 7:59 am
Location: Texas, USA

Re: Change my username on cloned system

Post by hayden »

Flemur wrote:
Mon Oct 12, 2020 10:02 am
new user won't be able to access the old user's files without some fiddling.
That is correct, but that doesn't pertain to OP as his user is not trying to access files that belong to another user.
pbear
Level 15
Level 15
Posts: 5664
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: Change my username on cloned system

Post by pbear »

Sigh. Surely rene's procedure (linked above, fifth post in the thread) is a lot simpler.
hayden
Level 2
Level 2
Posts: 72
Joined: Thu Apr 07, 2011 7:59 am
Location: Texas, USA

Re: Change my username on cloned system

Post by hayden »

pbear wrote:
Mon Oct 12, 2020 10:41 am
Sigh. Surely rene's procedure (linked above, fifth post in the thread) is a lot simpler.
That talks about changing the computer name (hostname), which is different from what OP is asking help with. OP is asking how to change his username.
pbear
Level 15
Level 15
Posts: 5664
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: Change my username on cloned system

Post by pbear »

Good grief. Try reading the post itself, not just the thread title. rene addresses the distinction in the first paragraph.
hayden
Level 2
Level 2
Posts: 72
Joined: Thu Apr 07, 2011 7:59 am
Location: Texas, USA

Re: Change my username on cloned system

Post by hayden »

Hello. Yes you are correct, I didn't see that. Apologies. Yes that is probably a better way to do this as my method is more manual and tedious.
pbear
Level 15
Level 15
Posts: 5664
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: Change my username on cloned system

Post by pbear »

Conversely, I assume your method works. And maybe it's easier at this point to get the OP over that wall, rather than start over.
Mainly, I want to encourage anyone looking to bookmark a solution to read rene's. Then make your own decision.
Pepper-Mint-Patty
Level 4
Level 4
Posts: 370
Joined: Fri Dec 20, 2019 4:54 pm

Re: Change my username on cloned system

Post by Pepper-Mint-Patty »

Must say you lost me but I am back on track again.

Read rene's 3rd post in viewtopic.php?p=1848557#p1848557 which method seems to be very simple ‘simple’ and straightforward!
Is rene’s 3rd + next message really all to it?
I’ll get to it then. 8)
Language is a virus _ . _ . _ . _ . _ . _ . _ . _ . _ . _ 19.2 Cinn + 4.15-91 + Nemo 4.2.3
Pepper-Mint-Patty
Level 4
Level 4
Posts: 370
Joined: Fri Dec 20, 2019 4:54 pm

Re: Change my username on cloned system

Post by Pepper-Mint-Patty »

Well that didn't go as expected. Fascinating how many things can go wrong. Even when you are trying very hard...
Sadly i cant make a screen shot of the (Ctrl-Alt-F1) terminal to show what is going on.
Managed to change a hostname, though it only shows in terminal, not in home.
Did do the kad-eye-cha thing

Code: Select all

xed admin:///etc/hostname
... change there
Followed by a change here:

Code: Select all

xed admin:///etc/hosts
Reboot.

And rene's

Code: Select all

usermod --login ginny14 --move-home --home /home/ginny14 theoldusername
groupmod --new-name ginny14 theoldusername
brought up: not recognised: --new-name

Somehow the hostname is changed, the username isn't.
Language is a virus _ . _ . _ . _ . _ . _ . _ . _ . _ . _ 19.2 Cinn + 4.15-91 + Nemo 4.2.3
pbear
Level 15
Level 15
Posts: 5664
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: Change my username on cloned system

Post by pbear »

I've tested rene's instructions and they work, so you've made an error somewhere.

ETA: Just tested again. Worked fine, but one wrinkle. (Discussed in the askubuntu link I gave above.) If get an error when running the usermod command, olduser currently used by process 0123, have to run kill 0123, then re-run the usermod command. Might have to do again, if there's a second (or third) process in use.
Post Reply

Return to “Newbie Questions”