You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by aaron smith <be...@gmail.com> on 2007/07/22 16:27:32 UTC

unix svn hooks, permissions / sudo?

Hey all,

I've got a script I'm trying to execute in my hook script. Is there
anyway to get around permisisons issues? currently when it runs I get
a "password:" prompt back in the log files. It's probably prompting
for root password. If I don't use "sudo" then I don't get the prompt
but I get a "permission denied". The script is writing a file to
another virtual host document root..

any ideas?

thanks all..

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: unix svn hooks, permissions / sudo?

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Jul 22, 2007, at 11:27, aaron smith wrote:

> I've got a script I'm trying to execute in my hook script. Is there
> anyway to get around permisisons issues? currently when it runs I get
> a "password:" prompt back in the log files. It's probably prompting
> for root password. If I don't use "sudo" then I don't get the prompt
> but I get a "permission denied". The script is writing a file to
> another virtual host document root..

You can configure sudo to not require a password for certain users, I  
believe... Consult your unix documentation.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: unix svn hooks, permissions / sudo?

Posted by aaron smith <be...@gmail.com>.
On 7/22/07, Rainer Sokoll <R....@intershop.de> wrote:
> On Sun, Jul 22, 2007 at 02:34:05PM -0400, timotheus wrote:
>
> > # /etc/sudoers
> > # user apache may run this command without a password prompt
> > apache  ALL=(root) NOPASSWD: /bin/bash /var/www/my_script.sh
>
> Please use visudo to edit /etc/sudoers.
>
> Rainer
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
>
>

Thanks.. editing the sudoers file worked fine.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: unix svn hooks, permissions / sudo?

Posted by Rainer Sokoll <R....@intershop.de>.
On Sun, Jul 22, 2007 at 02:34:05PM -0400, timotheus wrote:

> # /etc/sudoers
> # user apache may run this command without a password prompt
> apache  ALL=(root) NOPASSWD: /bin/bash /var/www/my_script.sh

Please use visudo to edit /etc/sudoers.

Rainer

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: unix svn hooks, permissions / sudo?

Posted by timotheus <ti...@tstotts.net>.
"aaron smith" <be...@gmail.com> writes:

> Hey all,
>
> I've got a script I'm trying to execute in my hook script. Is there
> anyway to get around permisisons issues? currently when it runs I get
> a "password:" prompt back in the log files. It's probably prompting
> for root password. If I don't use "sudo" then I don't get the prompt
> but I get a "permission denied". The script is writing a file to
> another virtual host document root..
>
> any ideas?
>
> thanks all..

Two very different approaches that might work for you.


(1)

# /etc/sudoers
# user apache may run this command without a password prompt
apache  ALL=(root) NOPASSWD: /bin/bash /var/www/my_script.sh



(2)

/* ~/tmp/run_as_myuser.c */

#include <stddef.h>
#include <stdlib.h>
#include <unistd.h>

int main (void) {
  /* UID and GID of my personal user */
  uid_t my_uid = 501; 
  gid_t my_gid = 501;

  /* run as myuser with a full login shell */
  setreuid(my_uid, my_uid);
  setregid(my_gid, my_gid);
  setenv("HOME", "/home/myuser", 1);
  execl("/bin/bash", "bash", "--login", "-c", "bash /home/myuser/public_html/my_script.sh", (const char*) NULL);
  return(EXIT_FAILURE);
}

/* To compile:
   gcc run_as_myuser.c -o run_as_myuser
   chown myuser:myuser run_as_myuser
   chmod u=rxs,g=xs,o=x run_as_myuser
*/


Regards,
-timotheus

Re: unix svn hooks, permissions / sudo?

Posted by Jeff D <fi...@gmail.com>.
On Sun, 22 Jul 2007, aaron smith wrote:

> Hey all,
>
> I've got a script I'm trying to execute in my hook script. Is there
> anyway to get around permisisons issues? currently when it runs I get
> a "password:" prompt back in the log files. It's probably prompting
> for root password. If I don't use "sudo" then I don't get the prompt
> but I get a "permission denied". The script is writing a file to
> another virtual host document root..
>
> any ideas?
>
> thanks all..
>

How are you writing to the file? Would it be possible to give group write 
access to the file to the svn group?


-+-
8 out of 10 Owners who Expressed a Preference said Their Cats Preferred Techno.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org