You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by st...@yahoo.com on 2004/04/20 21:26:11 UTC
execute command as root
I have a script that needs to chown some files as
root, but I don't want to have to execute everything
as root. I've been trying to use 'su' with no success.
Any ideas? I've been trying variations on the
following:
<exec executable="su">
<arg value="-c 'chown -R someUser /var/tomcat'
root"/>
</exec>
I've also tried running it from a shell:
<exec executable="sh">
<arg line="su -c 'chown -R someUser /var/tomcat'
root"/>
</exec>
Should I be able to do something like this? I either
get an error telling me that su wants input from stdin
or that sh cannot run an executable.
-sc
__________________________________
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25�
http://photos.yahoo.com/ph/print_splash
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: execute command as root
Posted by "Neil J. O'Neill" <nj...@llnl.gov>.
You can run su inside of an xterm:
<exec
executable="/usr/X11R6/bin/xterm"
>
<arg
line='-e su -c "chown -R someUser /var/tomcat" root'
/>
</exec>
--NJO
On Tue, 2004-04-20 at 12:26, stevecanfield@yahoo.com wrote:
> I have a script that needs to chown some files as
> root, but I don't want to have to execute everything
> as root. I've been trying to use 'su' with no success.
> Any ideas? I've been trying variations on the
> following:
> <exec executable="su">
> <arg value="-c 'chown -R someUser /var/tomcat'
> root"/>
> </exec>
>
> I've also tried running it from a shell:
> <exec executable="sh">
> <arg line="su -c 'chown -R someUser /var/tomcat'
> root"/>
> </exec>
>
> Should I be able to do something like this? I either
> get an error telling me that su wants input from stdin
> or that sh cannot run an executable.
>
> -sc
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Photos: High-quality 4x6 digital prints for 25
> http://photos.yahoo.com/ph/print_splash
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: execute command as root
Posted by Matt Benson <gu...@yahoo.com>.
--- stevecanfield@yahoo.com wrote:
> AFAIK, you cannot pipe a password to su. I think
> this
> is for security reasons.
You're right. What about the rest of it?
-Matt
__________________________________
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25�
http://photos.yahoo.com/ph/print_splash
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: execute command as root
Posted by st...@yahoo.com.
AFAIK, you cannot pipe a password to su. I think this
is for security reasons.
--- Matt Benson <gu...@yahoo.com> wrote:
> Don't you need to pipe a password to su? You could
> do
> that using exec's inputstring (or to redirect from a
> file, input) attribute... or for another idea, you
> could put the chown into a shell script owned by
> root
> and turn on SETUID for the shell script. At least
> this way you don't store root's password anyway and
> you can control access to the script with groups...
> you could also look into the kinds of things you can
> do with sudo...
>
> -Matt
>
> --- stevecanfield@yahoo.com wrote:
> > I have a script that needs to chown some files as
> > root, but I don't want to have to execute
> everything
> > as root. I've been trying to use 'su' with no
> > success.
> > Any ideas? I've been trying variations on the
> > following:
> > <exec executable="su">
> > <arg value="-c 'chown -R someUser /var/tomcat'
> > root"/>
> > </exec>
> >
> > I've also tried running it from a shell:
> > <exec executable="sh">
> > <arg line="su -c 'chown -R someUser
> /var/tomcat'
> > root"/>
> > </exec>
> >
> > Should I be able to do something like this? I
> either
> > get an error telling me that su wants input from
> > stdin
> > or that sh cannot run an executable.
> >
> > -sc
> >
> >
> >
> >
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! Photos: High-quality 4x6 digital prints for
> > 25�
> > http://photos.yahoo.com/ph/print_splash
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > user-unsubscribe@ant.apache.org
> > For additional commands, e-mail:
> > user-help@ant.apache.org
> >
>
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Photos: High-quality 4x6 digital prints for
> 25�
> http://photos.yahoo.com/ph/print_splash
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
>
__________________________________
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25�
http://photos.yahoo.com/ph/print_splash
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: execute command as root
Posted by Matt Benson <gu...@yahoo.com>.
Don't you need to pipe a password to su? You could do
that using exec's inputstring (or to redirect from a
file, input) attribute... or for another idea, you
could put the chown into a shell script owned by root
and turn on SETUID for the shell script. At least
this way you don't store root's password anyway and
you can control access to the script with groups...
you could also look into the kinds of things you can
do with sudo...
-Matt
--- stevecanfield@yahoo.com wrote:
> I have a script that needs to chown some files as
> root, but I don't want to have to execute everything
> as root. I've been trying to use 'su' with no
> success.
> Any ideas? I've been trying variations on the
> following:
> <exec executable="su">
> <arg value="-c 'chown -R someUser /var/tomcat'
> root"/>
> </exec>
>
> I've also tried running it from a shell:
> <exec executable="sh">
> <arg line="su -c 'chown -R someUser /var/tomcat'
> root"/>
> </exec>
>
> Should I be able to do something like this? I either
> get an error telling me that su wants input from
> stdin
> or that sh cannot run an executable.
>
> -sc
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Photos: High-quality 4x6 digital prints for
> 25�
> http://photos.yahoo.com/ph/print_splash
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
>
__________________________________
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25�
http://photos.yahoo.com/ph/print_splash
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org