Change user 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 this

Change user name

Postby TTime on Sun Feb 10, 2013 4:40 pm

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.

viewtopic.php?f=60&t=113075#p631394 sudo usermod -l <New Username> <Old Username>
- comes up with usermod: user 'xxxxxxxxx' does not exist

viewtopic.php?f=90&t=40736#p234269 no .bashrc

viewtopic.php?f=90&t=19290&start=0#p114752 brings up an error - usermod: invalid option -- 'i'
TTime
Level 1
Level 1
 
Posts: 20
Joined: Mon Oct 08, 2012 6:20 am

Linux Mint is funded by ads and donations.
 

Re: Change user name

Postby cwsnyder on Sun Feb 10, 2013 5:00 pm

-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:
LMDE Mate 64-bit, LM16 Mate 64-bit
Debian Xfce 64-bit, Xubuntu 13.10 64-bit, Xubuntu Trusty Tahr 64-bit, Antergos Xfce 64-bit, PCLinuxOS LXDE 64-bit
cwsnyder
Level 6
Level 6
 
Posts: 1039
Joined: Wed Oct 20, 2010 6:49 am
Location: Nappanee, IN, USA

Re: Change user name

Postby xenopeek on Sun Feb 10, 2013 5:05 pm

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".
User avatar
xenopeek
Level 21
Level 21
 
Posts: 14978
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Change user name

Postby TTime on Mon Feb 11, 2013 7:34 am

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.
TTime
Level 1
Level 1
 
Posts: 20
Joined: Mon Oct 08, 2012 6:20 am

Re: Change user name

Postby proxima_centauri on Mon Feb 11, 2013 12:07 pm

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>
User avatar
proxima_centauri
Level 11
Level 11
 
Posts: 3976
Joined: Tue Dec 25, 2007 3:24 pm
Location: NB, Canada

Re: Change user name

Postby TTime on Mon Feb 11, 2013 2:05 pm

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.
TTime
Level 1
Level 1
 
Posts: 20
Joined: Mon Oct 08, 2012 6:20 am

Re: Change user name

Postby xenopeek on Mon Feb 11, 2013 2:18 pm

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
User avatar
xenopeek
Level 21
Level 21
 
Posts: 14978
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Change user name

Postby TTime on Mon Feb 11, 2013 3:19 pm

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.
TTime
Level 1
Level 1
 
Posts: 20
Joined: Mon Oct 08, 2012 6:20 am

Re: Change user name

Postby xenopeek on Mon Feb 11, 2013 3:29 pm

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 /
User avatar
xenopeek
Level 21
Level 21
 
Posts: 14978
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Change user name

Postby TTime on Mon Feb 11, 2013 3:52 pm

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.
TTime
Level 1
Level 1
 
Posts: 20
Joined: Mon Oct 08, 2012 6:20 am

Linux Mint is funded by ads and donations.
 

Return to Newbie Questions

Who is online

Users browsing this forum: tdockery97 and 32 guests