[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: root can't sudo



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.

-- 
  .''`.     Stephen Powell    
 : :'  :
 `. `'`
   `-


Reply to: