How to make an administrator account

Asked by Muhammad Umar Ibrahim

There were two user accounts in my friends laptop. One was standard whereas other was an administrator account. He accidentally changed the administrator account into standard account. Now he can't do any administrative tasks. He asked me for help.
There is no administrator account in his ubuntu 12.04.1. I selected drop to root shell prompt option in recovery menu. Tried to change root password it gave following error
" Authentication token manipulation error"
Then i tried to add his account in sudo group but i faced following error
" usermod: cannot lock/etc/passwd ; try again later"
Now what should i do to convert one of his standard user account into administrator account?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu gnome-desktop Edit question
Assignee:
No assignee Edit question
Solved by:
actionparsnip
Solved:
Last query:
Last reply:
Revision history for this message
ahambidge (ahambidge) said :
#1

Hello

Boot up the computer as normal and login to the old Admin account. Go to the Applications menu/System Tools/System Settings/User Accounts and change it from standard to administrator.

Regards,

Allan :)

Revision history for this message
Muhammad Umar Ibrahim (mumaribrahim) said :
#2

To change that old (Admin)user account from standard to administrator again it asks for administrator password; since there is no administrator there, it can't be done. ( It don't accepts old administrator password)

Revision history for this message
Mark Rijckenberg (markrijckenberg) said :
#3
Revision history for this message
Muhammad Umar Ibrahim (mumaribrahim) said :
#4

Can somebody please guide me after understanding my question in above scenario?

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#5

Run:

whoami

this is your username. Write this down or memorize it. Reboot the system and hold SHIFT, select recovery mode then select root. You can now run these 2 commands:

usermod -a -G sudo name
usermod -a -G admin name

change name for your username. Eg;

usermod -a -G sudo andy
usermod -a -G admin name

Then run:

reboot

You can now log in as name and use sudo to do stuff. You can even use the same commands (prefixed with sudo) to add the other account to the same groups

Revision history for this message
Muhammad Umar Ibrahim (mumaribrahim) said :
#6

What is it or how to do it?
                                                  Run:
                                                whoami

i already have done that second step by selecting root from recovery mode which you mentioned.
It gave following error

" usermod: cannot lock/etc/passwd ; try again later"

and thanks for replying :)

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#7

Press CTRL+ALT+T

run the command there

Revision history for this message
Muhammad Umar Ibrahim (mumaribrahim) said :
#8

in terminal ?ok
These are two commands Run and whomi or just one and should i type : after run? and for what purpose it is used?

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#9

'run' isn't itself a command, that's just me listing commands

Revision history for this message
Muhammad Umar Ibrahim (mumaribrahim) said :
#10

whomi just shows current user name
and usermod -a -G sudo name gives following error
" usermod: cannot lock/etc/passwd ; try again later"
so Mr. Andrew what should i do now? any other solution?

Revision history for this message
Best actionparsnip (andrew-woodhead666) said :
#11

In the root recovery console run:

mount -o remount,rw /

Then rerun:

usermod -a -G sudo name

Revision history for this message
Muhammad Umar Ibrahim (mumaribrahim) said :
#12

Thanks actionparsnip, that solved my question.