On Windows, running a process as a different user should set the 
environment variables for the user.   Have you followed the instructions 
in http://staf.sourceforge.net/current/STAFUG.htm#HDRWINUSER "Starting a 
Process Under a Different User on Windows"?

The  ":3:env" is a length delimited format that is of the form 
:<Length>:<String>, and is documented here:
http://staf.sourceforge.net/current/STAFUG.htm#HDROVFORM "7.2 Option Value 
Formats".

David Bender
STAF/STAX Development
8-1268 (512-838-1268) 
IBM Austin Bldg. 903-5B002
Internet: [EMAIL PROTECTED]




"Sandy Young" <[EMAIL PROTECTED]> 
10/06/2008 10:34 PM

To
Sharon Lucas/Austin/[EMAIL PROTECTED]
cc
staf-users@lists.sourceforge.net
Subject
Re: [staf-users] start procee with different user on RH4 server






Thank you all very much!

Now I can run shell command as another user with associated env vars 
successfully. But I still have two more question, 

1, How can I run shell command as another user with associated env vars on 
Windows XP SP3? I have run comand as another user successful. But 
associated env vars didn't loaded automatically. Is there any way to 
resolve this problem?

2,  In this command "STAF local PROCESS START SHELL "su - %u -c %C" 
COMMAND :3:env RETURNSTDOUT STDERRTOSTDOUT USERNAME staf", what is 
":3:env"  mean? I can't find anything useful about this term.

Best regards,
   Homer

On Mon, Oct 6, 2008 at 11:14 PM, Sharon Lucas <[EMAIL PROTECTED]> wrote:

You can use the ENV option on a PROCESS start request to set environment 
variables like PATH and CLASSPATH (or perhaps run a shell script that sets 
the enviroment variables  in conjunction with whatever command your 
process is starting.   There is an open bug to investigate how STAF can 
automatically set environment variables for a particular user on Unix. See 
Bug #1334433 at 
http://sourceforge.net/tracker/index.php?func=detail&aid=1334433&group_id=33142&atid=407381
 
for a possible workaround using "su" in the shell to run the process as a 
different user.  For example, to run a process as another user and have 
the environment variables for this user, try specifying: 

  SHELL "su - %u -c %C"

For example, with STAFProc started as root, you can run a process as a 
user "user1" and use it's environment variables as shown by running the 
env command to show the environment variables used by the process:

STAF local PROCESS START SHELL "su - %u -c %C" COMMAND env RETURNSTDOUT 
STDERRTOSTDOUT USERNAME user1

--------------------------------------------------------------
Sharon Lucas
IBM Austin,   [EMAIL PROTECTED]
(512) 838-8347 or Tieline 678-8347



"Sandy Young" <[EMAIL PROTECTED]> 
10/06/2008 04:47 AM 


To
staf-users@lists.sourceforge.net 
cc

Subject
Re: [staf-users] start procee with different user on RH4 server








Hi,

I follow your suggestion and try again, and make it successful to run 
shell command with another user. The reason why I failed last time is that 
I didn't start staf with root user. Thank you very much!

But how about my second question? I want to run shell command with a 
different user and its enviroment. For all enviroment variables associated 
with the new user will not be loaded automatically. But my shell command 
depends on enviroment variables such as PATH, CLASSPATH and so on. Is 
there any way to make staf load enviroment variables automatically?

Best regards,
  Homer

On Mon, Sep 29, 2008 at 3:50 AM, Javier Collado <[EMAIL PROTECTED]> 
wrote: 
Hello,

Maybe the problem is that the ability to launch a process with a
different user is disabled by default. However, you may change
PROCESSAUTHMODE variable in your STAF.cfg configuration file to enable
it. From the user's guide SET PROCESSAUTHMODE <value>:

<<
  * DISABLED - This indicates that the user may not specify a
username/password with which to authenticate when starting a process.
This mode is available on all platforms. This is default mode.
  * WINDOWS - This indicates that windows-based authentication
should be used. This mode is only available on Windows systems. See
"Starting a Process Under a Different User on Windows" for more
information.
  * NONE - This indicates that usernames will be honored but not 
authenticated. In this mode, passwords are ignored and processes are 
started under the indicated username. This mode is only available on
Unix systems.
>>

Best regards,
  Javier

2008/9/28 Sandy Young <[EMAIL PROTECTED]>: 
> Hi, guys:
>
> I want to use process service to start a shell command with another user
> rather than current user,. Follow <STAF V3 User's Guide>, I think that 
such
> a command may do that:
>
> staf local process start shell command whoami username yl password 
123456
> wait returnstdout returnstderr
>
> But it failed when execute this command. Below is error message:
>
> Error during process authentication for user name yl
>
> Somebody could tell me why?
>
> I also get an infomation from
> 
http://www.mail-archive.com/staf-users@lists.sourceforge.net/msg00219.html
> that even this command executes succcessed, all enviroment variables
> associated with the new user will not be loaded automatically. But my 
shell
> command depends on enviroment variables such as PATH and other. Is there 
any
> way to make staf load enviroment variables automatically? 
> 
-------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's 
challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the 
world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> staf-users mailing list 
> staf-users@lists.sourceforge.net 
> https://lists.sourceforge.net/lists/listinfo/staf-users
>
> 
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's 
challenge
Build the coolest Linux based applications with Moblin SDK & win great 
prizes
Grand prize is a trip for two to an Open Source event anywhere in the 
world
http://moblin-contest.org/redirect.php?banner_id=100&url=/_______________________________________________

staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's 
challenge
Build the coolest Linux based applications with Moblin SDK & win great 
prizes
Grand prize is a trip for two to an Open Source event anywhere in the 
world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

Reply via email to