Sorry, what troubled me is because I was so careless to set PROCESSAUTHMODE
to Windows. After I checked it again and corrected it, SATF worked correctly
as you said.
Thank you very much for your patient and careful help those days, and wish
you happy everyday!
Best regards,
Homer
On Wed, Oct 8, 2008 at 10:22 PM, David Bender <[EMAIL PROTECTED]> wrote:
>
> Starting a STAF PROCESS as another user correctly picks up that user's
> environment variables for me. For example, on a Windows XP system I have a
> user "staf" that I am using to start STAFProc, and a "test" user that has 2
> user environment variables defined, MYENV1 and MYENV2. If I start a PROCESS
> specifying the USERNAME test, the output of the process ("set") correctly
> shows the "test" user's environment variables:
>
> C:\>STAF local PROCESS SET PROCESSAUTHMODE Windows
> Response
> --------
>
>
> C:\>STAF local PROCESS START SHELL COMMAND set RETURNSTDOUT WAIT USERNAME
> test P
> ASSWORD mypassword
> Response
> --------
> {
> Return Code: 0
> Key : <None>
> Files : [
> {
> Return Code: 0
> Data : ALLUSERSPROFILE=C:\Documents and Settings\All Users
> APPDATA=C:\Documents and Settings\test\Application Data
>
> CLASSPATH=C:\STAF\samples\demo\STAFDemo.jar;C:\STAF\bin\JSTAF.jar;C:\STAF\sample
>
> s\demo\STAFDemo.jar;C:\STAF\bin\JSTAF.jar;C:\STAF\samples\demo\STAFDemo.jar;C:\S
>
> TAF\bin\JSTAF.jar;C:\STAF\samples\demo\STAFDemo.jar;C:\STAF\bin\JSTAF.jar;C:\STA
>
> F\samples\demo\STAFDemo.jar;C:\STAF\bin\JSTAF.jar;C:\STAF\samples\demo\STAFDemo.
>
> jar;C:\STAF\bin\JSTAF.jar;C:\STAF\samples\demo\STAFDemo.jar;C:\STAF\bin\JSTAF.ja
>
> r;C:\STAF\samples\demo\STAFDemo.jar;C:\STAF\bin\JSTAF.jar;C:\STAF\samples\demo\S
>
> TAFDemo.jar;C:\STAF\bin\JSTAF.jar;C:\STAF\samples\demo\STAFDemo.jar;C:\STAF\bin\
> JSTAF.jar;C:\STAF\samples\demo\STAFDemo.jar;C:\STAF\bin\JSTAF.jar
> CommonProgramFiles=C:\Program Files\Common Files
> COMPUTERNAME=WINXP-VM
> ComSpec=C:\WINDOWS\system32\cmd.exe
> FP_NO_HOST_CHECK=NO
> HOMEDRIVE=C:
> HOMEPATH=\Documents and Settings\test
> LOGONSERVER=\\WINXP-VM
> *MYENV1=value1*
> *MYENV2=value2*
> NUMBER_OF_PROCESSORS=1
> OS=Windows_NT
>
> Path=C:\STAF\bin;C:\STAF\bin;C:\STAF\bin;C:\STAF\bin;C:\STAF\bin;C:\STAF\bin;C:\
>
> STAF\bin;C:\STAF\bin;C:\STAF\bin;C:\STAF\bin;C:\STAF\bin;C:\Perl\site\bin;C:\Per
>
> l\bin;C:\ibmjava142\jre\bin;C:\ibmjava142\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\
> WINDOWS\System32\Wbem
> PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
> PROCESSOR_ARCHITECTURE=x86
> PROCESSOR_IDENTIFIER=x86 Family 6 Model 15 Stepping 8, GenuineIntel
> PROCESSOR_LEVEL=6
> PROCESSOR_REVISION=0f08
> ProgramFiles=C:\Program Files
> PROMPT=$P$G
> SESSIONNAME=Console
> STAFCONVDIR=C:\STAF\codepage
> SystemDrive=C:
> SystemRoot=C:\WINDOWS
> TEMP=C:\DOCUME~1\test\LOCALS~1\Temp
> TMP=C:\DOCUME~1\test\LOCALS~1\Temp
> USERDOMAIN=WINXP-VM
> *USERNAME=test*
> USERPROFILE=C:\Documents and Settings\test
> windir=C:\WINDOWS
>
> }
> ]
> }
>
> Note that in order to get this to work, you need to follow the instructions
> in the "Starting a Process Under a Different User on Windows" STAF User's
> Guide section. Specifically you need to change the Windows setting for the
> user under which STAFProc is started to allow it to "Replace a process level
> token" and re-login as that user (and start STAFProc again).
>
> If this is still not working for you, please provide a detailed
> reproduction scenario including the exact STAF commands you are executing.
>
> David Bender
> STAF/STAX Development
> 8-1268 (512-838-1268)
> IBM Austin Bldg. 903-5B002
> Internet: [EMAIL PROTECTED]
>
>
>
> *"Sandy Young" <[EMAIL PROTECTED]>*
>
> 10/07/2008 10:15 PM
> To
> David Bender/Austin/[EMAIL PROTECTED]
> cc
> staf-users@lists.sourceforge.net Subject
> Re: [staf-users] start procee with different user on RH4 server
>
>
>
>
> Actually I can run a process as a different user on windows. I just don't
> know how to load user env vars by staf automatically.
>
> Currently I am in a project that provide a unitive interface for many users
> to run their test on a distributed enviroment. The ability to run test on
> remote machines is provide by STAF. Because many tests depend on special
> enviroment, we create some different users on all machine and set up
> enviroment. Follow your kind help, I have been able to start a process under
> a specific user with associated enviroment variables on linux, but now I am
> feazed by how to do it on windows.
>
> Best regards,
> Homer
>
> On Tue, Oct 7, 2008 at 10:01 PM, David Bender <[EMAIL PROTECTED]<[EMAIL
> PROTECTED]>>
> wrote:
>
> 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*<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*<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] <[EMAIL PROTECTED]>
>
>
> *"Sandy Young" <[EMAIL PROTECTED] <[EMAIL PROTECTED]>*>*
>
> 10/06/2008 10:34 PM
>
> To
> Sharon Lucas/Austin/[EMAIL PROTECTED] cc
> [EMAIL PROTECTED] <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]<[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
> *<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] <[EMAIL PROTECTED]>
> (512) 838-8347 or Tieline 678-8347
>
> *"Sandy Young" <[EMAIL PROTECTED] <[EMAIL PROTECTED]>*>*
>
> 10/06/2008 04:47 AM
>
> To
> [EMAIL PROTECTED] <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]
> * <[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] <[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
> *<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=/*<http://moblin-contest.org/redirect.php?banner_id=100&url=/>
> > _______________________________________________
> > staf-users mailing list
> > [EMAIL PROTECTED] <staf-users@lists.sourceforge.net>
> > *https://lists.sourceforge.net/lists/listinfo/staf-users*<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=/_______________________________________________
> *<http://moblin-contest.org/redirect.php?banner_id=100&url=/_______________________________________________>
> staf-users mailing list*
> [EMAIL PROTECTED] <staf-users@lists.sourceforge.net>*
> **https://lists.sourceforge.net/lists/listinfo/staf-users*<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=/_______________________________________________
> *<http://moblin-contest.org/redirect.php?banner_id=100&url=/_______________________________________________>
> staf-users mailing list*
> [EMAIL PROTECTED] <staf-users@lists.sourceforge.net>*
> **https://lists.sourceforge.net/lists/listinfo/staf-users*<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