0

I am preety new to Linux. Recently, I used the command "sudo chown -R me ./" to grant myself permission to a certain folder. If it matters at all, I ran this command in the '/var/www' folder. Since then, the docker container keeps restarting and failing to start. I get an error:

Launching nginx...
Launching php-fpm...
Launching websocket server...
sudo: /etc/sudo.conf is owned by uid 1000, should be 0
sudo: /etc/sudo.conf is owned by uid 1000, should be 0
sudo: error in /etc/sudo.conf, line 0 while loading plugin "sudoers_policy"
sudo: /usr/lib/sudo/sudoers.so must be owned by uid 0
sudo: fatal error, unable to load plugins
sudo: /etc/sudo.conf is owned by uid 1000, should be 0
sudo: /etc/sudo.conf is owned by uid 1000, should be 0
sudo: error in /etc/sudo.conf, line 0 while loading plugin "sudoers_policy"
sudo: /usr/lib/sudo/sudoers.so must be owned by uid 0
sudo: fatal error, unable to load plugins
Launching frontend...
sudo: /etc/sudo.conf is owned by uid 1000, should be 0
sudo: /etc/sudo.conf is owned by uid 1000, should be 0
sudo: error in /etc/sudo.conf, line 0 while loading plugin "sudoers_policy"
sudo: /usr/lib/sudo/sudoers.so must be owned by uid 0
sudo: fatal error, unable to load plugins
addgroup: group 'user' in use
adduser: user 'user' in use
Setting timezone to Europe/Warsaw
sudo: /etc/sudo.conf is owned by uid 1000, should be 0
sudo: /etc/sudo.conf is owned by uid 1000, should be 0
sudo: error in /etc/sudo.conf, line 0 while loading plugin "sudoers_policy"
sudo: /usr/lib/sudo/sudoers.so must be owned by uid 0
sudo: fatal error, unable to load plugins

I've already tried to change the permissions on these files, because the error says that these files should be owned by root. The problem is that sudo.cfg is already owned by root:

Screenshot of /etc/ folder permissions

And when I try to give proper permissions to '/usr/lib/sudo/sudoers.so', it tells me that there is no such path:

chmod: cannot access '/usr/lib/sudo/sudoers.so': No such file or directory

What more could I do? Do I have to reinstall the system?

4
  • 1
    You might have accidentally included a space and ran sudo chown -R me . /. Reinstalling is the simplest option.
    – muru
    Jun 9, 2023 at 9:05
  • 1
    Now you can learn the backup skills. And next time do not do that. Add yourself to the group of other files (e.g. httpd/www-data), but keep for safety and security most administrative users/groups for themselves. As you see: we make error, so we do not want to wrongly edit/override files without huge warnigns -- see also: unix.stackexchange.com/questions/79125/… Jun 9, 2023 at 9:06
  • 1
    What does the screenshot show? If it doesn't already, please remember to include the command as text that generated whatever permissions it shows - don't post pictures of text. Jun 9, 2023 at 9:09
  • 1
    (almost) always singlequote or doublequote arguments: chown -R yourname '/path/to/thedirectory' # would be much safer, even if you by mistake add a space somewhere in the path. Jun 9, 2023 at 11:52

1 Answer 1

1

You're not giving us enough detail to make an educated guess, but I'll take a stab at it anyway.

I assume that the error messages above happen inside your docker container, and that said container lives (for reasons unknown?) under /var/www ...

I'll also give you the benefit of the doubt that you indeed were in that directory and indeed issued verbatim what you wrote.

What you need to check now is the ownership of those files inside the docker image, not the host machine you're logged into running nginx.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .