I recently installed ubuntu on a virtual machine using VirtualBox and whenever i need to use a sudo command(any) i can't because my only user is not in the sudoer file. I tried using the sudo -i command or visudo but it always gives me no permission to use it. How then to I go about using root privileges?
Asked
Active
Viewed 51 times
0
-
1The default user created during the installation *should* be in `sudoers` and be able to run all `sudo` commands. However, if somehow the user didn't get in there or was removed, see - [How do I reset a lost administrative password?](https://askubuntu.com/questions/24006/how-do-i-reset-a-lost-administrative-password) – NotTheDr01ds Dec 10 '22 at 17:14
-
You've not provided any product/release details (are you asking about Ubuntu Core? Ubuntu Desktop? or Ubuntu Server?) as the user created during most product installs is granted `sudo` rights. You've also not said if you altered the `sudoers` file, as any error/mistake introduced into that file is treated as the EOF (*end of file*) marker & subsequent lines are ignored (*that's why it has a special command to edit it; that command checks for errors prior to exist to avoid making the file ~empty thru careless error*) – guiverc Dec 10 '22 at 20:39
-
Is your user a member of the `sudo` group? `id` will tell. If not, Boot to single user mode (to get `root`), then `adduser your_user sudo`. Then boot back to multiuser with `sudo shutdown -r now`. Login, and test with `id;sudo id`. – waltinator Dec 10 '22 at 22:21