Re: Should I redefine PATH in my shell scripts



Francis Moreau <francis.moro@xxxxxxxxx> writes:

Maxwell Lol <nospam@xxxxxxxxxxx> writes:

Francis Moreau <francis.moro@xxxxxxxxx> writes:

Actually I've been hit when trying to run a script through sudo. It
fails because the PATH is changed by sudo and external tools couldn't
be called anymore.

This sounds like a good thing. If you let sudo run any external tool,
you risk the danger of someone being able to break into the root
account.

Fair enough but some of my scripts are intended to be run as root
only.

And if I log to root account by using 'su -' then it works fine. But
if I used "sudo my-script.sh" then it fails.

But if it is run by sudo, then it is invoked by a non-root user. And
if you get an error, then perhaps your script is not secure.

.



Relevant Pages

  • Re: Unix assigning permissions to windows 2000/3 folders
    ... I have talked to other Unix ... information and then spawns another script that excutes a 'sudo' command. ... If all else fails - READ THE INSTRUCTIONS! ...
    (microsoft.public.windows.server.scripting)
  • Re: apt-get upgrade for sudo fails with segmentation fault
    ... Does something else fails too? ... I have a new installation of hardy ... apt-get wants to update sudo, but whenever I do I get the error ... Preparing to replace sudo 1.6.9p10-1ubuntu3 (using ...
    (Ubuntu)
  • Re: Should I redefine PATH in my shell scripts
    ... fails because the PATH is changed by sudo and external tools couldn't ... If you let sudo run any external tool, ... Fair enough but some of my scripts are intended to be run as root ... if I used "sudo my-script.sh" then it fails. ...
    (comp.unix.shell)
  • Re: Should I redefine PATH in my shell scripts
    ... fails because the PATH is changed by sudo and external tools couldn't ... If you let sudo run any external tool, ... Fair enough but some of my scripts are intended to be run as root ... if I used "sudo my-script.sh" then it fails. ...
    (comp.unix.shell)
  • Re: setuid root
    ... Patrick Useldinger wrote: ... still fails when it tries to write to any file that only root has ... Given the situation I am facing, I will probably use sudo, it keeps things cleaner... ...
    (comp.lang.python)