Quantcast

Execute shell script and using correct user

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Execute shell script and using correct user

Domen Kožar
Hello,

I'm having a issue with running shell script through hudson.

Following statement runs Python buildout, which does some svn checkouts
(traceback is attached to email):

./bin/buildout -c development.cfg

The main problem is that when python script tries to do subversion
checkout, it tries to use root credentials.

Later I printed following vars in shell:

echo $USER
root
echo $HOME
/root

I have no idea why these are set to root, if hudson is runing under
hudson:hudson unix user/group?

Also specifing username/password in hudson subversion credentials system
does not help at all.

The main question is, how do I tell hudson to run the script under
hudson, so the right credentials will be picked?
(from /var/lib/hudson/home/.subversion/auth/svn.simple/..)

Cheers, Domen



lala (3K) Download Attachment
signature.asc (501 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Execute shell script and using correct user

Sami Tikka
If Hudson were really running as root, it would not have problems
opening the file /root/.subversion/servers.

The problem is probably that Hudson is running as a non-root user, but
the environment variables inherited by Hudson still have USER=root and
HOME=/root. I think you have a buggy Hudson startup script.

-- Sami

2010/5/8 Domen Kožar <[hidden email]>:

> Hello,
>
> I'm having a issue with running shell script through hudson.
>
> Following statement runs Python buildout, which does some svn checkouts
> (traceback is attached to email):
>
> ./bin/buildout -c development.cfg
>
> The main problem is that when python script tries to do subversion
> checkout, it tries to use root credentials.
>
> Later I printed following vars in shell:
>
> echo $USER
> root
> echo $HOME
> /root
>
> I have no idea why these are set to root, if hudson is runing under
> hudson:hudson unix user/group?
>
> Also specifing username/password in hudson subversion credentials system
> does not help at all.
>
> The main question is, how do I tell hudson to run the script under
> hudson, so the right credentials will be picked?
> (from /var/lib/hudson/home/.subversion/auth/svn.simple/..)
>
> Cheers, Domen
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Execute shell script and using correct user

Domen Kožar
Indeed, seems like start-stop-deamon does not inherit environment when
switching user. No idea how to fix it yet.

Cheers, Domen

On Sun, 2010-05-09 at 22:06 +0300, Sami Tikka wrote:

> If Hudson were really running as root, it would not have problems
> opening the file /root/.subversion/servers.
>
> The problem is probably that Hudson is running as a non-root user, but
> the environment variables inherited by Hudson still have USER=root and
> HOME=/root. I think you have a buggy Hudson startup script.
>
> -- Sami
>
> 2010/5/8 Domen Kožar <[hidden email]>:
> > Hello,
> >
> > I'm having a issue with running shell script through hudson.
> >
> > Following statement runs Python buildout, which does some svn checkouts
> > (traceback is attached to email):
> >
> > ./bin/buildout -c development.cfg
> >
> > The main problem is that when python script tries to do subversion
> > checkout, it tries to use root credentials.
> >
> > Later I printed following vars in shell:
> >
> > echo $USER
> > root
> > echo $HOME
> > /root
> >
> > I have no idea why these are set to root, if hudson is runing under
> > hudson:hudson unix user/group?
> >
> > Also specifing username/password in hudson subversion credentials system
> > does not help at all.
> >
> > The main question is, how do I tell hudson to run the script under
> > hudson, so the right credentials will be picked?
> > (from /var/lib/hudson/home/.subversion/auth/svn.simple/..)
> >
> > Cheers, Domen
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


signature.asc (501 bytes) Download Attachment
Loading...