Operating System - Linux
1748176 Members
4280 Online
108758 Solutions
New Discussion юеВ

SSH problem with servicegard

 
Adam Noble
Super Advisor

SSH problem with servicegard

Hi all,

Have a strange problem with SAP extension with serviceguard which I am confident relates to ssh.

Basically the cluster runs a remote script via ssh to start the Application instance on the remote node. The issue I believe is environment. It for example needs the path /usr/sap/SWP/SYS/exe/run set. This is not happening and I believe this to be the issue. When I run a remote command to the application server to simply give me the env output it is not the same as when you su to the user on the box.

On a cluster that is working I get the correct output. The specific SAP user is running csh shell and as I say if I login as that user all is fine so it must relate to the files ssh uses to set env. On the other cluster the same ssh command to give me the env output gives me the same as if I logged in i.e the DIR_LIBRARY is set as expected.

Any help would be appreciated.
2 REPLIES 2
Matti_Kurkela
Honored Contributor

Re: SSH problem with servicegard

Well, sshd certainly provides an initial PATH setting for a SSH session, but in HP-UX, it's normally immediately overwritten by /etc/profile or /etc/csh.login. Both of those read the new setting from /etc/PATH.

The first question would be: exactly where and how are the necessary environment variables set in the working case?

You mentioned the SAP user uses the csh shell.

Does /etc/csh.login include everything that /etc/profile does (or the appropriate equivalents)? How about /etc/csh.cshrc? And the user-specific login scripts: since csh does not execute .profile, does the SAP user's ~/.login and/or ~/.cshrc do everything required?

What is the exact syntax of your su command? "su sapuser" or "su - sapuser"? If you use the first form, some variables that are set in the environment of the original user will "leak" to the SAP user's environment (intentionally or otherwise).

If you haven't tried "su - sapuser", try it now; I think it might fail just like when trying to use ssh. In that case, double-check your csh login scripts: make sure they will initialize everything SAP requires.

If "su - sapuser" works but SSH fails, be aware that SSH by default won't allocate a TTY for the connection at the remote side if you supply it with a remote command. This will often cause parts of login scripts to be skipped.

Try adding option "-t" to your SSH command line... or maybe even "-tt", since if the cluster runs the remote command, the client end of the SSH command might not have a TTY either.

MK
MK
TwoProc
Honored Contributor

Re: SSH problem with servicegard

Yes, very often you'll need to call your environment setting scripts before you try to run your commands that start/stop the environments.

So, figure out which scripts aren't being run and you'll have to run them prior to whatever commands bring up and down the server.

In ksh, the command to run a scripts is just a "." by itself on a line, which will make the commands in the script run as if they were being in the current command shell.

for example:
. /home/SAPADM/bin/environment_set

Then, you can run your commands to actually start/stop things.

In csh, the command is "source"
for example:
source /home/SAPADM/bin/environment_set

Then, you can run your commands to actually start/stop things.

We are the people our parents warned us about --Jimmy Buffett