Score:0

Accidentally gave my user root permissions while trying to set file permissions How to fix?

mx flag

I copied my default config file to my ~/.config directory and then gave myself ownership of that file not realizing that it would give my user root permissions system wide without having to type my password for sudo. I don't like that and want to go back to having a regular user account. Here is the command I used to copy the file and change permissions:

cp -rv /etc/libvirt/libvirt.conf ~/.config/libvirt/ &&sudo chown $dino:$dino ~/.config/libvirt/libvirt.conf 

dino is my user and I guess I accidentally typed it for my group as well.

Is there a way to fix this?

RonJohn avatar
cn flag
Look in `~/.config/libvirt/libvirt.conf`. What does it say? (Anyway, that confuses me; maybe I'm too old school, but I thought `/etc/sudoers` was the only way to give someone passwordless sudo privs.
24601 avatar
in flag
Does this answer your question? [Remove sudo privileges from a user (without deleting the user)](https://askubuntu.com/questions/335987/remove-sudo-privileges-from-a-user-without-deleting-the-user)
waltinator avatar
it flag
Since `$dino` is an undefined variable, it expands to the NULL string, "". You did `&& sudo chown : ~/.config/libvirt/libvirt.conf`. Look at `ls -l ~/.config/libvirt/libvirt.conf` - it's probably owned by `root:root`. To fix: `sudo chown $(id -u):$(id -g) ~/.config/libvirt/libvirt.conf`.
dino avatar
mx flag
Thank you waltinator. That fixed it! I knew it had something to do with the group variable but wasn't sure how to fix. I'm trying to set permissions for QEMU. I'm trying to get a VM up and running but I'm having problems getting my permissions right. I'm sure system wide root privileges is one way to fix it but that's not the solution for me. I'll figure out another way. Thanks for your help.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.