Garith Dugmore wrote on 19.12.2006 at 00:34:06 [Re: [BackupPC-users] Backing up 
a client with tar and ssh]:
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
> <head>
>   <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
> </head> 
> <body bgcolor="#ffffff" text="#000000">
> Thnx Torsten,<br>
> <br>
> This worked. I also had to add a sudo for the env command..<br>
> <br>    
> [more top-posted HTML removed]

Actually, you only need an entry for the env command, but please note what
you're doing: you're granting the apache user the right to execute *any*
command as root via 'env' - probably not something you want to do. You
probably *meant* something like

> apache ALL=NOPASSWD: /usr/bin/env LC_ALL=C /bin/tar *

meaning "let user apache execute the command /usr/bin/env with the arguments
'LC_ALL=C /bin/tar' and any others following that (on all machines to which
this sudoers file applies, without being prompted for a password)".

One other example approach might be to set

> Defaults:apache       env_delete += LC_ALL

and leave out the env command completely. Note that this may or may not
work depending on system configuration. You might also have to env_delete
LANG and/or LANGUAGE, and tar might still find some reason not to speak
English - not quite sure, and I can't test, because my systems tend to speak
English by default anyway (meaning I probably don't need to set LC_ALL at
all). Come to think of it, I use

> $Conf {TarClientCmd} = '/usr/bin/env LC_ALL=C sudo $tarPath ...'

which avoids the problem in the first place. Really, why set the environment
as root when you can just as well do it as unpriviledged user?

So, stick to the third solution and put the 'env' outside (meaning "in front
of") the 'sudo', and keep the other things in mind for more complicated
problems :-).

Regards,
Holger

P.S.: Regarding your *original* problem, 'ssh -l root wind ...' working from
      a root shell but not as apache from within backuppc, that's just it.
      You should have tried what happens, when you run it *as apache* from
      a shell. For reference: to get a shell running as the apache user, try
      something like 'su - -s /bin/bash apache'.
      But for accessing localhost, prefer the sudo approach you are now
      using over the ssh approach. It's easier to restrict the commands that
      apache can run as root that way (and you save the unnecessary overhead
      of encrypting and decrypting the data).

[1] http://en.wikipedia.org/wiki/Netiquette

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
BackupPC-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/backuppc-users
http://backuppc.sourceforge.net/

Reply via email to