I just installed STAF on two Ubuntu 16.04 machines and able to run command using "staf <remotehost> <service> <request>". But when I try to run gui application on remote host, it is throwing DISPLAY error. I am accessing both Linux machines through Putty (from windows client) with X11 forwarding enabled and also I have installed xming. Note that, if I run: $ staf local process start shell command "xclock" wait stderrtostdout returnstdout , it is working fine. But if i use: $ staf remotehost process start shell command "xclock" wait stderrtostdout returnstdout
I am getting below error:
Response
Interestingly, If I have putty session running for remotehost, then clock gui starts fine. So it seems that through STAF, X11 forwarding is not getting enabled. Please let me know how to enable it in STAF configuration.
Last edit: Shambhu Sharma 2017-07-10
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The issue I found is with setting up user environment with STAF. If I try to use:
$ STAF remotehost PROCESS START SHELL "su - %u -c %C" COMMAND env RETURNSTDOUT STDERRTOSTDOUT USERNAME user1
I am getting error:
Data : su: must be run from a terminal
How to use "su" with "remotehost"?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
When using the PROCESS service to run a command, the process is run within the environment in hich STAFProc is running. To run a gui command like xclock on a remote system, you need to set the DISPLAY environment variable. You can use the ENV option on a PROCESS START request to set environment variables such as DISPLAY. See section "8.13.2 START" in the STAF User's Guide at http://staf.sourceforge.net/current/STAFUG.htm#HDRPROCSRV for more information on the ENV option.
In regards to how to use "su" tp run a command via a PROCESS START request, here's an example of how to run the "env" command on a remote Linux RHEL system using "su" and specifying to run the command as a user named test1:
Note that when the value of an option is the same as the name of the option (or another supported option), the value must be distinguished as such by using the colon-length-colon delimited format. For example, env (aka ENV) is the name of an option for the PROCESS START request so to specify env as the value of the option, you should specify COMMAND :3:env as talked about in section "7.2 Option Value Formats" in the STAF User's Guide at http://staf.sourceforge.net/current/STAFUG.htm#HDROVFORM.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Sharon,
Thanks for your reply. I am still getting the error "Data : su: must be run from a terminal". I am using Ubuntu 16.04.
$ STAF autorat2 PROCESS START SHELL "su - %u -c %C" COMMAND pwd USERNAME autotest WAIT STDERRTOSTDOUT RETURNSTDOUT
Response
{
Return Code: 1
Key : <None>
Files : [
{
Return Code: 0
Data : su: must be run from a terminal
}
]
}
I am getting correct output, if I do not use "su - %u -c %C".
Don't set ProcessAuthMode to "None" on autorat2 (the system where the process will be run). Leave it set to the default setting "Disabled". This is because you're using "su" to run the process under a different user.
Also, make sure you're running STAFProc as root on autorat2.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I just installed STAF on two Ubuntu 16.04 machines and able to run command using "staf <remotehost> <service> <request>". But when I try to run gui application on remote host, it is throwing DISPLAY error. I am accessing both Linux machines through Putty (from windows client) with X11 forwarding enabled and also I have installed xming. Note that, if I run: $ staf local process start shell command "xclock" wait stderrtostdout returnstdout , it is working fine. But if i use:
$ staf remotehost process start shell command "xclock" wait stderrtostdout returnstdout
I am getting below error:
Response
{
Return Code: 1
Key : <None>
Files : [
{
Return Code: 0
Data : Error: Can't open display: localhost:10.0
]
}
Interestingly, If I have putty session running for remotehost, then clock gui starts fine. So it seems that through STAF, X11 forwarding is not getting enabled. Please let me know how to enable it in STAF configuration.
Last edit: Shambhu Sharma 2017-07-10
The issue I found is with setting up user environment with STAF. If I try to use:
$ STAF remotehost PROCESS START SHELL "su - %u -c %C" COMMAND env RETURNSTDOUT STDERRTOSTDOUT USERNAME user1
I am getting error:
Data : su: must be run from a terminal
How to use "su" with "remotehost"?
When using the PROCESS service to run a command, the process is run within the environment in hich STAFProc is running. To run a gui command like xclock on a remote system, you need to set the DISPLAY environment variable. You can use the ENV option on a PROCESS START request to set environment variables such as DISPLAY. See section "8.13.2 START" in the STAF User's Guide at http://staf.sourceforge.net/current/STAFUG.htm#HDRPROCSRV for more information on the ENV option.
In regards to how to use "su" tp run a command via a PROCESS START request, here's an example of how to run the "env" command on a remote Linux RHEL system using "su" and specifying to run the command as a user named test1:
Note that when the value of an option is the same as the name of the option (or another supported option), the value must be distinguished as such by using the colon-length-colon delimited format. For example, env (aka ENV) is the name of an option for the PROCESS START request so to specify env as the value of the option, you should specify COMMAND :3:env as talked about in section "7.2 Option Value Formats" in the STAF User's Guide at http://staf.sourceforge.net/current/STAFUG.htm#HDROVFORM.
Hi Sharon,
Thanks for your reply. I am still getting the error "Data : su: must be run from a terminal". I am using Ubuntu 16.04.
$ STAF autorat2 PROCESS START SHELL "su - %u -c %C" COMMAND pwd USERNAME autotest WAIT STDERRTOSTDOUT RETURNSTDOUT
Response
{
Return Code: 1
Key : <None>
Files : [
{
Return Code: 0
Data : su: must be run from a terminal
]
}
I am getting correct output, if I do not use "su - %u -c %C".
$ STAF autorat2 PROCESS START SHELL COMMAND pwd USERNAME autotest WAIT STDERRTOSTDOUT RETURNSTDOUT
Response
{
Return Code: 0
Key : <None>
Files : [
{
Return Code: 0
Data : /usr/local/staf
]
}
Am i missing any configuration? I have set "Process Auth Mode" to "None" in both staf machines.
Don't set ProcessAuthMode to "None" on autorat2 (the system where the process will be run). Leave it set to the default setting "Disabled". This is because you're using "su" to run the process under a different user.
Also, make sure you're running STAFProc as root on autorat2.
Hi Sharon,
Thanks. After disabling ProcessAuthMode on autorat2, it is working fine now :)