I had no problem invoking my scripts embedded with sudo as root before,
but not now in my new installation:
root@coral:~# echo abc | sudo tee /tmp/t
sudo: can't open /etc/sudoers: Permission denied
sudo: no valid sudoers sources found, quitting
root@coral:~# id
uid=0(root) gid=0(root) groups=0(root)
root@coral:~# ls -l /etc/sudoers
-r--r----- 1 root root 2354 2010-09-17 09:34 /etc/sudoers
root@coral:~# head -1 /etc/sudoers
# sudoers file.
What could be wrong?
Thanks
--
Tong (remove underscore(s) to reply)
http://xpt.sourceforge.net/techdocs/
http://xpt.sourceforge.net/tools/
--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/i7raph$96h$1...@dough.gmane.org
grep root /etc/sudoers
--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/AANLkTimGUqRTrZy8_R-8Q...@mail.gmail.com
>> What could be wrong?
>
> grep root /etc/sudoers
% grep ^root /etc/sudoers
root ALL=(ALL) ALL
It has always been there.
--
Tong (remove underscore(s) to reply)
http://xpt.sourceforge.net/techdocs/
http://xpt.sourceforge.net/tools/
--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/i7rd64$96h$2...@dough.gmane.org
--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
I have used sudo as root - but with a username as an argument. Without
a username, it defaults to root, and I can't figure out why you would want that.
Cheers,
Kelly Clowers
--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/AANLkTimeA-yMvrFoRLg=CDD1k_dpK7Gu...@mail.gmail.com
> I dont use sudo, but can you explain me,so I will go to bed with more
> knowledge, why root would need sudo?
invoking my scripts embedded with sudo as root
--
Tong (remove underscore(s) to reply)
http://xpt.sourceforge.net/techdocs/
http://xpt.sourceforge.net/tools/
--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/i7rg8i$qmi$2...@dough.gmane.org
It doesn't make any sense to use sudo as root without an "-u user"
(and therefore to sudo to root as root) but it should work.
--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/AANLkTikkcA=y3X=93pmBXe5n7PA2F...@mail.gmail.com
Sorry, no idea then.
--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/AANLkTimSWPCLf7ko4zbA1...@mail.gmail.com
Spoke too early.
Do you have the "!root_sudo" option set?
--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/AANLkTikHmGrNQ-PKfBJMC...@mail.gmail.com
> Do you have the "!root_sudo" option set?
Nope:
$ sudo cat /etc/sudoers | grep root_sudo || echo no
no
Thank you all the same.
--
Tong (remove underscore(s) to reply)
http://xpt.sourceforge.net/techdocs/
http://xpt.sourceforge.net/tools/
--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/i7rjhp$4p0$1...@dough.gmane.org
You're welcome.
Do you have an "/etc/pam.d/sudo" file? Can another user use sudo? Any
hint about the reason for the failure in "/var/log/auth.log"?
--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/AANLkTinbWdLRT3UswTFh92qskrn5=FKu3ii8F+=G9...@mail.gmail.com
The failed environment is a linux-live environment that I built myself.
When mirroring it to HD, everything works fine. So it's actually the live
environment's problem, not sudo's.
Thanks again for your comprehensive tips, which I'll garter bellow in
case someone else need to troubleshoot:
- Make sure the 'root ALL=(ALL) ALL' line is in /etc/sudoers
% grep ^root /etc/sudoers
root ALL=(ALL) ALL
- should not have the "!root_sudo" option set
$ sudo cat /etc/sudoers | grep root_sudo || echo no
no
Also check,
On Mon, 27 Sep 2010 22:44:07 -0400, Tom H wrote:
> Do you have an "/etc/pam.d/sudo" file? Can another user use sudo? Any
> hint about the reason for the failure in "/var/log/auth.log"?
Thanks again.
--
Tong (remove underscore(s) to reply)
http://xpt.sourceforge.net/techdocs/
http://xpt.sourceforge.net/tools/
--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/i7rla8$94d$1...@dough.gmane.org
You're welcome.
--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/AANLkTi=wHezFLBGK+Lk3Fv6=rjSJwK5e8DtE=AK+...@mail.gmail.com
--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
> Am 28.09.2010 02:16, schrieb Tom H:
>> On Mon, Sep 27, 2010 at 7:53 PM, T o n g wrote:
>>>
>>> What could be wrong?
>>
>> grep root /etc/sudoers
>>
>>
> Why should one use "sudo" in addition to being root and thus having all
> rights?
+1 :-)
Greetings,
--
Camaleón
--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
I don't speak for the OP, but my guess is that the OP has a
script that he wants to be able to run either as his non-superuser
self or as root. The script needs to perform a function that
normally requires root privileges. There are two possible approaches:
(1) Do userid tests and have dual-path code: one for root and one
for a non-root user. Execute the special command directly if the
userid is root. Execute it via sudo if the userid is not root.
(2) Unconditionally execute the special command via sudo and don't
worry about who the userid is. The second approach is simpler.
--
.''`. Stephen Powell
: :' :
`. `'`
`-
--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/1076335335.329489.1285...@md01.wow.synacor.com
> On Tue, 28 Sep 2010 02:58:05 +0200, Thierry Chatelet wrote:
>
>> I dont use sudo, but can you explain me,so I will go to bed with more
>> knowledge, why root would need sudo?
>
> invoking my scripts embedded with sudo as root
>
I'm, not sure what you mean by "embedded" here, so my guess
is that you mean making something like this work for both
user and root:
user@machine ~/$ cat > aptupgscript.sh <<EOF
#!/bin/sh
echo Hello
sudo aptitude update
sudo aptitude upgrade
echo Update done by `whoami` || tee ~/done.log
EOF
user@machine ~/$ chmod a+x aptupgscript.sh
user@machine ~/$ ./aptupgscript.sh
Hello
Update done by user
user@machine ~/$ su
Enter password:
root@machine ~/$ ./aptupgscript.sh
Hello
Update done by root
root@machine ~/$
(Sorry for possible wrong details, I typed it from mind :D)
Thanks,
aL.
--
Alois Mahdal using Opera's revolutionary e-mail client:
http://www.opera.com/mail/
--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/op.vjqxu...@aloism.cz.avg.com
> On Tue, 28 Sep 2010 06:13:58 -0400 (EDT), Camaleón wrote:
>> On Tue, 28 Sep 2010 09:01:10 +0200, Alexander Hintzer wrote:
>>> Why should one use "sudo" in addition to being root and thus having
>>> all rights?
>>
>> +1 :-)
>
> I don't speak for the OP, but my guess is that the OP has a script that
> he wants to be able to run either as his non-superuser self or as root.
> The script needs to perform a function that normally requires root
> privileges. There are two possible approaches: (1) Do userid tests and
> have dual-path code: one for root and one for a non-root user. Execute
> the special command directly if the userid is root. Execute it via sudo
> if the userid is not root. (2) Unconditionally execute the special
> command via sudo and don't worry about who the userid is. The second
> approach is simpler.
I see. A "lazy" programming issue :-)
Greetings,
--
Camaleón
--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
S> I don't speak for the OP, but my guess is that the OP has a script that
S> he wants to be able to run either as his non-superuser self or as root.
Easy. This preserves arguments including spaces:
#!/bin/sh
PATH=/usr/local/bin:/bin:/usr/bin; export PATH
test "`id -u`" -gt 0 && exec sudo $0 "$@"
whoami
for arg in "$@"; do
echo "[$arg]"
done
exit 0
--
Karl Vogel I don't speak for the USAF or my company
EXCUSE FOR GETTING TO WORK LATE #7:
The dog ate my car keys. We're going to hitchhike to the vet.
--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/201009281854...@kev.msw.wpafb.af.mil
> I don't speak for the OP, but my guess is that the OP has a script that
> he wants to be able to run either as his non-superuser self or as root.
Exactly. Thanks Stephen.
--
Tong (remove underscore(s) to reply)
http://xpt.sourceforge.net/techdocs/
http://xpt.sourceforge.net/tools/
--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/i7tnie$75o$2...@dough.gmane.org
>>> I dont use sudo, but can you explain me,so I will go to bed with more
>>> knowledge, why root would need sudo?
>>
>> invoking my scripts embedded with sudo as root
>>
> I'm, not sure what you mean by "embedded" here, so my guess is that you
> mean making something like this work for both user and root: . . .
Thanks for the clear illustration. Yep, that's what I meant.
Besides, I share my aliases between my normal account and root account,
many of them are using sudo and I don't want to define two sets for the
same functionalities.
cheers
--
Tong (remove underscore(s) to reply)
http://xpt.sourceforge.net/techdocs/
http://xpt.sourceforge.net/tools/
--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/i7tnh0$75o$1...@dough.gmane.org
> root@coral:~# echo abc | sudo tee /tmp/t
> sudo: can't open /etc/sudoers: Permission denied
> sudo: no valid sudoers sources found, quitting
What does this give you: ls -l $(type -p sudo)
Chris
--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/geqhn7x...@news.roaima.co.uk