[07-Dec-2018 23:42:41 Australia/Melbourne] PHP Fatal error: Call to undefined function add_action() in /home/nite/public_html/wp-content/themes/period/inc/customizer.php on line 4 [08-Dec-2018 01:32:35 Australia/Melbourne] PHP Fatal error: Call to undefined function add_action() in /home/nite/public_html/wp-content/themes/period/inc/customizer.php on line 4 [08-Dec-2018 06:37:12 Australia/Melbourne] PHP Fatal error: Call to undefined function add_action() in /home/nite/public_html/wp-content/themes/period/inc/customizer.php on line 4 [08-Dec-2018 19:14:07 Australia/Melbourne] PHP Fatal error: Call to undefined function add_action() in /home/nite/public_html/wp-content/themes/period/inc/customizer.php on line 4 [08-Dec-2018 20:19:09 Australia/Melbourne] PHP Fatal error: Call to undefined function add_action() in /home/nite/public_html/wp-content/themes/period/inc/customizer.php on line 4 [10-Dec-2018 04:41:06 Australia/Melbourne] PHP Fatal error: Call to undefined function add_action() in /home/nite/public_html/wp-content/themes/period/inc/customizer.php on line 4 [10-Dec-2018 04:43:38 Australia/Melbourne] PHP Fatal error: Call to undefined function add_action() in /home/nite/public_html/wp-content/themes/period/inc/scripts.php on line 31 How to recover sudo on Ubuntu - The importance of arguing - The Stick of Truth Press "Enter" to skip to content

How to recover sudo on Ubuntu – The importance of arguing

I made a little mistake the other night while fiddling with my laptop. In an alcohol infused rush to mount an NFS share I missed an argument while modifying groups. I was adding myself to a group that facilitates R/W access on my NFS accessed RAID.

DO NOT RUN THIS

user@machine$ sudo usermod USER -G GROUP

Where USER and GROUP are the relevant ones for the system. The problem with this is that withou “-aG” this subsitutes GROUP as the sole group for the user. The effect of this on an Ubuntu system with only one user is that you’ve now just removed the ability to act as root, while simultaneously breaking access to anything your user needs from other groups (this will affect applications and files). My additional complication here is an encrypted disk. Fortunately, a fix quickly came to mind.

  • Boot a live disk (Ubuntu MATE 18.04 in this case)
  • Mount the encrypted drive, made easy by this distro. Just a click on the drive in the file manager then entering the key is required
  • In a shell, modify /etc/sudoers
  • Add user to the sudoers file, example:
    USER ALL=(ALL:ALL) ALL
  • Reboot into original OS
  • You now have the ability to run sudo in order to repair groups
  • Run:

user@machine$ sudo usermod USER -aG sudo USER

  • The above will add your user back to the sudoers group which is potentially a tidier way of handling sudo access than the static file, additionally back to your own user’s group
  • You may need to identify additional groups that assist in running certain applications. In my case I needed “libvirt” and “libvirt-qemu” in order to manage my virtual machines
  • Having fixed these, I found it prudent to enable the root account which I  had forgotten to enable on this fairly recent install

user@machine$ sudo passwd root

  • This will request your sudo password, then the next prompt will allow you to set a root password

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *