How to make an administrator account

Asked by Muhammad Umar Ibrahim on 2012-10-20

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:
2012-10-23
Last query:
2012-10-23
Last reply:
2012-10-21
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 :)

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)

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

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

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 :)

Press CTRL+ALT+T

run the command there

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?

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

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?

In the root recovery console run:

mount -o remount,rw /

Then rerun:

usermod -a -G sudo name

Thanks actionparsnip, that solved my question.