Ubuntu thinks it is neat not to have a password on root. Hmm.
It is easy to remove yourself from all groups in linux, I did it like this:
$ useradd -G docker timp
I thought that might add timp to the group docker, which indeed it does, but it also removes you from adm,cdrom,lpadmin,sudo,dip,plugdev,video,audio which you were previously in.
As you are no longer in sudoers you cannot add yourself back.
Getting a root shell using RefiT
What we now need to get to is a root shell. Googling did not help.
I have Ubuntu 14.04 LTS installed as a dual boot on my MacBookPro (2011). I installed it using rEFIt.
My normal boot is power up, select RefiT, select most recent Ubuntu, press Enter.
To change the grub boot command instead of Enter press F2 (or +). You now have three options, one of which is single user: this hangs for me. Move to the 'Standard Boot' and again press F2 rather than Enter. This enables you to edit the kernel string. I tried adding Single, single, s, init=/bin/bash, init=/bin/sh, 5, 3 and finally 1.
By adding 1 to the grub kernel line you are telling the machine to boot up only to run level one.
This will boot to a root prompt! Now to add yourself back to your groups:
$ usermod -G docker,adm,cdrom,lpadmin,sudo,dip,plugdev,video,audio timp
Whilst we are here:
$ passwd root
Hope this helps, I hope I don't need it again!
Never use useradd always use adduser
No comments:
Post a Comment