Re: dapper sudo



Jack Bowling wrote:
On Tue, Jul 04, 2006 at 02:44:14PM +0100, Toby Kelsey wrote:
boricua wrote:
how come dapper does not allow me to do this

sudo cat /dev/null > /var/log/apache2/error.log


Because the sudo only applies to the command 'cat', not the redirection.

Try
sudo dd of=/var/log/apache2/error.log < /dev/null
or
sudo tee /var/log/apache2/error.log < /dev/null


It is a bug that there is no obvious command to truncate a file.


Could somebody tell me if there is any difference between the above cat
command and

[sudo] echo "" > /var/log/apache2/error.log

assuming one has sudo'ed to a root shell?

That assumption is the difference. So, yes, there IS a *HUGE* difference
between

sudo -s
echo > /var/log/apache2/error.log

(BTW: No need for the "echo" here, unless you're really after an empty
line).

and

sudo tee /var/log/apache2/error.log < /dev/null


The difference is, that the shell "executing" "> /var/log/apache2/error.log"
is run with root rights. That's actually more-or-less the same as doing

sudo sh -c " > /var/log/apache2/error.log"

Alexander Skwar
--
The more laws and order are made prominent, the more thieves and
robbers there will be.
-- Lao Tsu

--
ubuntu-users mailing list
ubuntu-users@xxxxxxxxxxxxxxxx
https://lists.ubuntu.com/mailman/listinfo/ubuntu-users



Relevant Pages

  • Re: Problems with su/sudo
    ... use this are not using the command that works differently from "sudo ... want bash to behave in a specific way when it is a root shell I just ... Everything else can be done in a user account with sudo providing the ... Ian Gregory ...
    (comp.sys.mac.system)
  • Shells
    ... system is being halted by root. ... I know, use sudo. ... I can't lock it down to the point where sudo is used to run command line ... Once in a root shell there ...
    (SunManagers)
  • Re: Apple recommending anti-virus software for Macs?
    ... > To be ultra-safe with the 'rm' command, ... Not a bad idea for root, It would drive me nuts in my user account. ... downloads directory and executing it. ... That I type an EOF is a trivial difference versus 'sudo' exiting ...
    (comp.sys.mac.system)
  • Re: Sudo
    ... >> in as adminB, then the system sees adminB on the ... >> If userA is not in sudoers, ... >> The sudo command itself only works for that command. ...
    (alt.linux)
  • Re: any way to track commands of a user logged in through ssh
    ... applies _to that command only_. ... the command they want to run with 'sudo', ... I use/run a Shell command that requires 'root' privileges...Especially ... So what do you think about creating a separate 'group' for certain ...
    (comp.os.linux.misc)