[solved] Change my username on cloned system

Quick to answer questions about finding your way around Linux Mint as a new user.
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. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
User avatar
Pepper-Mint-Patty
Level 5
Level 5
Posts: 965
Joined: Fri Dec 20, 2019 4:54 pm
Location: Royston Vasey

Re: Change my username on cloned system

Post by Pepper-Mint-Patty »

I find this command very confusing

Code: Select all

usermod --login ginny14 --move-home --home /home/ginny14 theoldusername
groupmod --new-name ginny14 theoldusername
If we would say actual username is 'actual' and the new username is 'future'. How exactly would the command look like?
Could add actual hostname = hostA, future hostname = hostF
If guns don't kill, then OxyContin doesn't either, heroin isn't addicitve and fairy tales are real.
19.2 Cinn, Nemo
pbear
Level 16
Level 16
Posts: 6569
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: Change my username on cloned system

Post by pbear »

It's not confusing in context. And even without context, surely it's obvious that ginny14 is the new name. So, you should be substituting whatever new name you want to use for ginny14 in the commands. Just as you should be substituting your actual old user name for theoldusername.
User avatar
Pepper-Mint-Patty
Level 5
Level 5
Posts: 965
Joined: Fri Dec 20, 2019 4:54 pm
Location: Royston Vasey

Re: Change my username on cloned system

Post by Pepper-Mint-Patty »

thanks pbear for your unconfusing remarks. Those lead me to this

Code: Select all

usermod --login future --move-home --home /home/future actual
groupmod --new-name future actual
Spent many an hour. tried over and over again. Have no bloody clue what is going on/ wrong. :(
I guess something is going wrong by getting root. Thats why i changed to

Code: Select all

su -
root@Tippa:~#
In other situations i get usermod: unrecognised option '--new-name'
That screen i can't copy.

After trying the first account i switched to the2nd account called third and tried root there. This screen i can copy.

third@Tippa:~$

Code: Select all

su -
Password:
root@Tippa:~#

Code: Select all

usermod --login future --move-home --home /home/ future  actual
Usage: usermod [options] LOGIN

Options:
-c, --comment COMMENT new value of the GECOS field
-d, --home HOME_DIR new home directory for the user account
-e, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE
-f, --inactive INACTIVE set password inactive after expiration
to INACTIVE
-g, --gid GROUP force use GROUP as new primary group
-G, --groups GROUPS new list of supplementary GROUPS
-a, --append append the user to the supplemental GROUPS
mentioned by the -G option without removing
him/her from other groups
-h, --help display this help message and exit
-l, --login NEW_LOGIN new value of the login name
-L, --lock lock the user account
-m, --move-home move contents of the home directory to the
new location (use only with -d)
-o, --non-unique allow using duplicate (non-unique) UID
-p, --password PASSWORD use encrypted password for the new password
-R, --root CHROOT_DIR directory to chroot into
-s, --shell SHELL new login shell for the user account
-u, --uid UID new UID for the user account
-U, --unlock unlock the user account
-v, --add-subuids FIRST-LAST add range of subordinate uids
-V, --del-subuids FIRST-LAST remove range of subordinate uids
-w, --add-subgids FIRST-LAST add range of subordinate gids
-W, --del-subgids FIRST-LAST remove range of subordinate gids
-Z, --selinux-user SEUSER new SELinux user mapping for the user account

root@Tippa:~# groupmod future actual
Usage: groupmod [options] GROUP

Options:
-g, --gid GID change the group ID to GID
-h, --help display this help message and exit
-n, --new-name NEW_GROUP change the name to NEW_GROUP
-o, --non-unique allow to use a duplicate (non-unique) GID
-p, --password PASSWORD change the password to this (encrypted)
PASSWORD
-R, --root CHROOT_DIR directory to chroot into

Code: Select all

exit
and Ctrl-Alt-F7 doesn't bring me the new username...
If guns don't kill, then OxyContin doesn't either, heroin isn't addicitve and fairy tales are real.
19.2 Cinn, Nemo
pbear
Level 16
Level 16
Posts: 6569
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: Change my username on cloned system

Post by pbear »

Sorry, don't know why you're having trouble. All I can say is, it worked for me. Have tested twice. Both went through easily, no drama.
User avatar
Pepper-Mint-Patty
Level 5
Level 5
Posts: 965
Joined: Fri Dec 20, 2019 4:54 pm
Location: Royston Vasey

Re: Change my username on cloned system

Post by Pepper-Mint-Patty »

@pbear, fair enough.
If guns don't kill, then OxyContin doesn't either, heroin isn't addicitve and fairy tales are real.
19.2 Cinn, Nemo
User avatar
Pepper-Mint-Patty
Level 5
Level 5
Posts: 965
Joined: Fri Dec 20, 2019 4:54 pm
Location: Royston Vasey

Re: Change my username on cloned system

Post by Pepper-Mint-Patty »

Since all went pearshape i did a clean install on the laptop. Now starting the whole HAYDEN procedure again. So when i've made another clone i know how to change the username.

users old , third
Logged in as third. Try to get root

Code: Select all

third@Patty:~$ sudo passwd root
[sudo] password for third:         
Sorry, user third is not allowed to execute '/usr/bin/passwd root' as root on Patty.
third@Patty:~$ 
If guns don't kill, then OxyContin doesn't either, heroin isn't addicitve and fairy tales are real.
19.2 Cinn, Nemo
User avatar
AndyMH
Level 21
Level 21
Posts: 13759
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Change my username on cloned system

Post by AndyMH »

Is third an adminstrator?

menu > admin > users and groups
Screenshot from 2020-10-18 10-59-20.png
or you might see (for some reason I have two "users and groups" giving different GUIs?).
Screenshot from 2020-10-18 11-01-36.png
If this click on change against the account type.

You will need to be logged in as an admin user to change the privileges on third, assuming old is the first one you created, that is probably an admin user.
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
hayden

Re: Change my username on cloned system

Post by hayden »

An admin account in Mint is essentially is adding a user to the sudo group in linux and other unix-like operating systems. It's just made easy-to-use by using the word "admin" to make it easier to understand for beginners. I'm not knocking it, but that's how it is.
User avatar
Pepper-Mint-Patty
Level 5
Level 5
Posts: 965
Joined: Fri Dec 20, 2019 4:54 pm
Location: Royston Vasey

Re: Change my username on cloned system

Post by Pepper-Mint-Patty »

AndyMH wrote: Sun Oct 18, 2020 6:05 am Is third an adminstrator?
It wasn't no. Which of all the settings must be activated?
If guns don't kill, then OxyContin doesn't either, heroin isn't addicitve and fairy tales are real.
19.2 Cinn, Nemo
User avatar
Pepper-Mint-Patty
Level 5
Level 5
Posts: 965
Joined: Fri Dec 20, 2019 4:54 pm
Location: Royston Vasey

Re: Change my username on cloned system

Post by Pepper-Mint-Patty »

For the 2nd time i have made a clean install now with names
third@old-HP and old@old-HP

I have given third these settings, see
Image

Code: Select all

third@old-HP:~$  cd /home && ls
lost+found  old  third  timeshift

Code: Select all

third@old-HP:/home$ ls -la
total 36
drwxr-xr-x  6 root  root   4096 Oct 18 16:57 .
drwxr-xr-x 24 root  root   4096 Oct 18 16:32 ..
drwx------  2 root  root  16384 Oct 18 15:47 lost+found
drwxr-xr-x 17 old   old    4096 Oct 18 18:01 old
drwxr-xr-x 18 third third  4096 Oct 18 18:11 third
drwxr-xr-x  9 root  root   4096 Oct 18 17:00 timeshift

Code: Select all

third@old-HP:/home$ sudo vim /etc/passwd
vim shows

Code: Select all

geoclue:x:121:127::/var/lib/geoclue:/usr/sbin/nologin
old:x:1000:1000:Patty,,,:/home/old:/bin/bash
third:x:1001:1001:,,,:/home/third:/bin/bash
changed into

Code: Select all

geoclue:x:121:127::/var/lib/geoclue:/usr/sbin/nologin
painful:x:1000:1000:Patty,,,:/home/painful:/bin/bash
third:x:1001:1001:,,,:/home/third:/bin/bash

Code: Select all

third@old-HP:/home$ cat /etc/shadow
cat: /etc/shadow: Permission denied
After reboot only third is shownto login... :(
If guns don't kill, then OxyContin doesn't either, heroin isn't addicitve and fairy tales are real.
19.2 Cinn, Nemo
hayden

Re: Change my username on cloned system

Post by hayden »

you also need to change group and shadow files, not just passwd
User avatar
Pepper-Mint-Patty
Level 5
Level 5
Posts: 965
Joined: Fri Dec 20, 2019 4:54 pm
Location: Royston Vasey

Re: Change my username on cloned system

Post by Pepper-Mint-Patty »

Yes i know, i tried but :

Code: Select all

third@old-HP:/home$ cat /etc/shadow
cat: /etc/shadow: Permission denied
If guns don't kill, then OxyContin doesn't either, heroin isn't addicitve and fairy tales are real.
19.2 Cinn, Nemo
hayden

Re: Change my username on cloned system

Post by hayden »

It's giving you permission denied because you are trying to cat the file as the user third, which this user does not have read permissions to that file. If you want to read it as third, then you will have to use sudo which temporarily elevates your access to files owned by root.

use:

Code: Select all

third@old-HP:/home$ sudo cat /etc/shadow
User avatar
Pepper-Mint-Patty
Level 5
Level 5
Posts: 965
Joined: Fri Dec 20, 2019 4:54 pm
Location: Royston Vasey

Re: Change my username on cloned system

Post by Pepper-Mint-Patty »

I am happy to say i've made a big process today.

Image

Only some leftovers:

With timeshift i've doen a restore snapshot.
Surprisingly all the attempts i ve done before to create usernames remained in the restored OS. But they don't show up in 'users and groups' How get ride of that? Talking about: 'kut' and 'third'. 'fourth' is an actual user i will delete later.

Code: Select all

adler@old-HP:~$ cd /home && ls
adler  fourth  kut  lost+found	third  timeshift
Image

Code: Select all

adler@old-HP:/home$ ls -la
total 44
drwxr-xr-x  8 root   root    4096 Oct 19 17:28 .
drwxr-xr-x 24 root   root    4096 Oct 18 16:32 ..
drwxr-xr-x 18 adler  adler   4096 Oct 19 17:14 adler
drwxr-xr-x 17 fourth fourth  4096 Oct 19 17:26 fourth
drwxr-xr-x 17 adler  adler   4096 Oct 19 16:10 kut
drwx------  2 root   root   16384 Oct 18 15:47 lost+found
drwxr-xr-x 18 fourth fourth  4096 Oct 19 16:08 third
drwxr-xr-x  9 root   root    4096 Oct 19 17:00 timeshift
adler@old-HP:/home$


I ve finally managed to create a username i like. Point is the links in the sidebar don't work anymore. for now i have just deleted them, but that shouldn't be i guess.
Image

I don't know why the first image doesn't show, it is only 38kb
If guns don't kill, then OxyContin doesn't either, heroin isn't addicitve and fairy tales are real.
19.2 Cinn, Nemo
hayden

Re: Change my username on cloned system

Post by hayden »

they don't show up in 'users and groups' How get ride of that?

Code: Select all

sudo rm -rf /home/kut
sudo rm -rf /home/third
In the last picture, who are you logged in as?

Also, in the output of ls of /home you can see permissions are screwed up. the kut directory is owned by adler:adler, and third is owned by fourth:fourth
But removing those folders will clear that up
User avatar
Pepper-Mint-Patty
Level 5
Level 5
Posts: 965
Joined: Fri Dec 20, 2019 4:54 pm
Location: Royston Vasey

Re: Change my username on cloned system

Post by Pepper-Mint-Patty »

things seem to be cleared up

Code: Select all

adler@old-HP:/home$ ls -la
total 44
drwxr-xr-x  8 root   root    4096 Oct 19 17:28 .
drwxr-xr-x 24 root   root    4096 Oct 18 16:32 ..
drwxr-xr-x 18 adler  adler   4096 Oct 19 19:25 adler
drwxr-xr-x 17 fourth fourth  4096 Oct 19 17:26 fourth
drwxr-xr-x 17 adler  adler   4096 Oct 19 16:10 kut
drwx------  2 root   root   16384 Oct 18 15:47 lost+found
drwxr-xr-x 18 fourth fourth  4096 Oct 19 16:08 third
drwxr-xr-x  9 root   root    4096 Oct 19 17:00 timeshift
adler@old-HP:/home$ sudo rm -rf /home/kut
[sudo] password for adler:         
adler@old-HP:/home$ sudo rm -rf /home/third
adler@old-HP:/home$ ls -la
total 36
drwxr-xr-x  6 root   root    4096 Oct 19 19:32 .
drwxr-xr-x 24 root   root    4096 Oct 18 16:32 ..
drwxr-xr-x 18 adler  adler   4096 Oct 19 19:25 adler
drwxr-xr-x 17 fourth fourth  4096 Oct 19 17:26 fourth
drwx------  2 root   root   16384 Oct 18 15:47 lost+found
drwxr-xr-x  9 root   root    4096 Oct 19 17:00 timeshift
adler@old-HP:~$ cd /home && ls
adler  fourth lost+found timeshift
hayden wrote: Mon Oct 19, 2020 12:58 pm In the last picture, who are you logged in as?
Not sure i guess adler, not fourth... Do you know what went wrong there?
If guns don't kill, then OxyContin doesn't either, heroin isn't addicitve and fairy tales are real.
19.2 Cinn, Nemo
User avatar
Pepper-Mint-Patty
Level 5
Level 5
Posts: 965
Joined: Fri Dec 20, 2019 4:54 pm
Location: Royston Vasey

Re: Change my username on cloned system

Post by Pepper-Mint-Patty »

hayden wrote: Mon Oct 19, 2020 12:58 pmAlso, in the output of ls of /home you can see permissions are screwed up. the kut directory is owned by adler:adler, and third is owned by fourth:fourth
But removing those folders will clear that up
kut and third are leftovers from changes i made before doing the last snapshot restore. Don't know why they appeared again?!
If guns don't kill, then OxyContin doesn't either, heroin isn't addicitve and fairy tales are real.
19.2 Cinn, Nemo
hayden

Re: Change my username on cloned system

Post by hayden »

Pepper-Mint-Patty wrote: Mon Oct 19, 2020 1:45 pm things seem to be cleared up
So all is ok? you're not getting the orange triangles anymore in the folder pane in the file browser?
kut and third are leftovers from changes i made before doing the last snapshot restore. Don't know why they appeared again?!
snapshot is probably newer than you think it is.
Not sure i guess adler, not fourth... Do you know what went wrong there?
I'm not sure which issue you asking about here.
User avatar
Pepper-Mint-Patty
Level 5
Level 5
Posts: 965
Joined: Fri Dec 20, 2019 4:54 pm
Location: Royston Vasey

Re: Change my username on cloned system

Post by Pepper-Mint-Patty »

hayden wrote: Mon Oct 19, 2020 1:53 pm So all is ok? you're not getting the orange triangles anymore in the folder pane in the file browser?
I had deleted them. Now there is none of them folders in the sidebar
snapshot is probably newer than you think it is.
Hmmm put it on once a week... whatever.
hayden wrote: Mon Oct 19, 2020 12:58 pmIn the last picture, who are you logged in as?
Not sure i guess adler, not fourth... Do you know what went wrong there?
If guns don't kill, then OxyContin doesn't either, heroin isn't addicitve and fairy tales are real.
19.2 Cinn, Nemo
hayden

Re: Change my username on cloned system

Post by hayden »

I had deleted them. Now there is none of them folders in the sidebar
Ok, re-add them. go to your /home/adler folder in the file browswer, click and drag the Documents, Desktop etc.. back over to the pane
Not sure i guess adler, not fourth... Do you know what went wrong there?
still not sure what you mean here
Locked

Return to “Beginner Questions”