Change user name

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.
Locked
TTime

Change user name

Post by TTime »

Change user (main) name driving me up the wall can anyone help?

Running Mint 13lts Mate 64Bit, all the ubuntu howtos fail as you cant login via root.


Tried changing via users and groups comes up with an error - prob as its the name of the admin user.

Adding a new user making them an admin and changing the name does not stick on reboot.

http://forums.linuxmint.com/viewtopic.p ... 75#p631394 sudo usermod -l <New Username> <Old Username>
- comes up with usermod: user 'xxxxxxxxx' does not exist

http://forums.linuxmint.com/viewtopic.p ... 36#p234269 no .bashrc

http://forums.linuxmint.com/viewtopic.p ... =0#p114752 brings up an error - usermod: invalid option -- 'i'
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
cwsnyder

Re: Change user name

Post by cwsnyder »

-Boot from your Live Mint DVD.
-Open a terminal window and type the following:

Code: Select all

sudo su
mkdir /media/mint
mount /dev/sda1 /media/mint
cd /media/mint
chroot /media/mint passwd root
-You will probably not be prompted for a password at the sudo su line, if so try entering mint. Enter a new password for the account root, then enter it again to confirm.
-You should be able to login as user root when you reboot and remove the Live DVD. Remember to disable the root login if you want your Mint install to act normally after you finish completely trashing your system. Also remember that the new user you create must be made part of the sudo group, and probably will need to use visudo editor to edit the sudo group file.

There is a reason why you don't normally change the main user name after an installation: Getting all of the proper group assignments and permissions straightened out is a PAIN. :!: :roll:
User avatar
xenopeek
Level 25
Level 25
Posts: 29511
Joined: Wed Jul 06, 2011 3:58 am

Re: Change user name

Post by xenopeek »

Is the username "main" something you chose yourself? I'm asking because that is username on the Linux Mint live session, and sometimes users mistake putting Linux Mint on a USB with having installed it, or when they have started the installation from inside Windows they haven't finished it. If you have an icon on your desktop "Install Linux Mint" then either of these is the case, and the live session isn't persistent--any changes you make are reverted after reboot or shutdown... You get to choose your username when you complete the Linux Mint installation.

Edit: you can log in as root just fine on Linux Mint, though you shouldn't need to as you can gain temporary root permissions with sudo. You can log in to the root console from the recovery menu, which on an installed version of Linux Mint you can access from GRUB (hold down left shift during boot to get GRUB to show if not shown by default). The password for root is the same as the one you picked during installation of Linux Mint for your own user account. Again, you shouldn't need to do this for any reason, but if you insist you want to log in as root to the graphical desktop you just need to enable that for MDM in the Login Window application. It's an option you can configure on the Security tab, "Allow local system administrator login".
Image
TTime

Re: Change user name

Post by TTime »

cwsnyder > No still adamantly refuses to allow admin to log in.

xenopeek > I meant the main user name on an installed system. ( sorry to confuse). I cant change the user name.
proxima_centauri

Re: Change user name

Post by proxima_centauri »

In regards to "usermod: invalid option -- 'i'". I made a typo on that forum post and should have been an "l" not an "i".

Try

Code: Select all

usermod -l <NewUsername> -d /home/<NewUsername> -m <OldUsername>
TTime

Re: Change user name

Post by TTime »

proxima_centauri wrote:In regards to "usermod: invalid option -- 'i'". I made a typo on that forum post and should have been an "l" not an "i".

Try

Code: Select all

usermod -l <NewUsername> -d /home/<NewUsername> -m <OldUsername>

Nope
mark@M13M32VB ~ $ sudo usermod -l tester -d /home/tester -m mark
[sudo] password for mark:
usermod: user mark is currently logged in

From another user -
test@M13M32VB ~ $ sudo usermod -l test -d /home/test -m mark
[sudo] password for test:
test is not in the sudoers file. This incident will be reported.
User avatar
xenopeek
Level 25
Level 25
Posts: 29511
Joined: Wed Jul 06, 2011 3:58 am

Re: Change user name

Post by xenopeek »

You had probably best do this from the root console that you can access through recovery mode from the GRUB boot menu (hold down left shift during boot to get the GRUB boot menu to show). The password for root is the same as the password you set during installation for the first user created then.

You can't modify a user this way, if you are logged in to that user. And from the second account you tried it, you hadn't made that user a member of the sudo group so that user isn't allowed to use sudo... Best do it from the root console. Do not do this if you have an encrypted home folder! In that case, just make it easy on yourself and create a new user account and copy over all your personal files from the old user account. And copy the group memberships.

On the root console you don't need sudo, so the command to rename 'mark' to 'tester' would be:

Code: Select all

usermod -l tester -d /home/tester -m mark
Image
TTime

Re: Change user name

Post by TTime »

hmm. got a little further...

wouldn't accept my password - due to cwsnyder's post
New root password used.

Used the command usermod -l tester -d /home/tester -m mark
Failed with
usermod: cannot lock /ect/paswd; try again later.

So a little later tried again ... same error.

Tried this with a backup and still the same error.
User avatar
xenopeek
Level 25
Level 25
Posts: 29511
Joined: Wed Jul 06, 2011 3:58 am

Re: Change user name

Post by xenopeek »

Right, you might have to remount the / partition in read-write mode on the root console. To that first, with:

Code: Select all

mount -o remount,rw /
Image
TTime

Re: Change user name

Post by TTime »

xenopeek wrote:Right, you might have to remount the / partition in read-write mode on the root console. To that first, with:

Code: Select all

mount -o remount,rw /

Did that all seemed to go ok, but -
your home directory is listed as: "/home/tester" but it does not appear to exist. do you want to log in with the / (root) directory as your home directory? it is unlikely anything will work unless you use a failsafe session. No/Yes

No brings me back to log in.
Yes brings up - User's $HOME/.dmrc file is being ignored...
Desktop is blank back with an error - Could not update ICE authority file/.ICEauthority - Logout (only option)

Back at the login the original name is no longer recognised (rewritten- I know) and logging in as tester brings up the same fault.

Time to reinstall with the name I want, Thanks for all the effort.
Locked

Return to “Beginner Questions”