Home » Infrastructure » Unix » Scripting problem
Scripting problem [message #97125] Sun, 16 December 2001 09:35 Go to next message
Kilmarac
Messages: 1
Registered: December 2001
Junior Member
Greetings,

Im trying to get a script, which runs as the user who owns it, to run either as a different user, or to run as root. Yes I am aware of the security implications of this, but I need to script to write to a file from the web, thats owned differently.

How do I do that?

----------------------------------------------------------------------
Re: Scripting problem [message #97129 is a reply to message #97125] Mon, 17 December 2001 06:06 Go to previous message
JOHN
Messages: 182
Registered: April 1998
Senior Member
You can use the su -c Unix command (runs as user_name).

#!/bin/sh
# This script Will run 2 commands as another user
su -c user_name "(echo 'Command1';echo 'Done')"

----------------------------------------------------------------------
Previous Topic: get number of bytes
Next Topic: Re: Scripting problem
Goto Forum:
  


Current Time: Tue Sep 22 07:40:09 CDT 2020