This question is not duplicate of Ignore sudo in bash script
I am making a docker image based on Ubuntu 14.04 docker image. As you know, root is default user in docker. When I ran a bash script to install a software, got
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 have tried chown root /usr/lib/sudo/sudoers.so
,but it is not working.
This behavior is weird :
ls (everyone can do this)
sudo ls (you can't do this even if you are root)
Because I am building a docker image, I don't want to install uncorrelated packages to make sudo support root. But there are bunch of sudo
in some bash scripts,so simply replacing sudo
to empty may not a good choice.
So I'm wondering if is there any way to only ignore sudo
when you are root
sudo script.sh
So ltl;dr simply remove sudo from your script, you can do this with sed. – Panther Jul 19 '17 at 03:56