SSH cycle process, bound to current user not process ID 1, if I su - user1, su - root then the process is bound to process id 1

Hi,

1) I connect to my server as ROOT using SSH, and cycle a process, the process the is bound to my current shell. (Don't want this)
2) If I connect using RSH, cycle a process it is bound to process ID 1 (which is how it is supposed to work)
3) If I connect using SSH, su - someuser, then from that user su - root, I can cycle the process and it is bound to process id 1 (Want)

What do I need to add to my environment to have it work with /bin/sh ? If I change my default shell to /bin/csh it also resolves it, however I need /bin/sh for other reasons...
LVL 2
java_programmerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gheistCommented:
1) is completely insecure
2) -"-
3) I do not understand

What do you mean by "bound" ???? - are you binding keys for line editor ??? or binding address to socket ???

What is that IT taht has to work with sh ???

If you add #!/bin/sh at the beginning of script it works with /bin/sh, even when you use csh as shell, changing via chsh or chfn.
0
java_programmerAuthor Commented:
SSH is quite secure . This posting is not to argue about security.

When I say bound I am talking about being bound to a process (the owning process) (do a ps),  when I say it is bound to SH, when my process restarts, instead of it's parent process being 1 (system) it is the current sh (shell) process.
0
gheistCommented:
then this simply is parent process, all works as expected....
PPID of 1 means that process has no parent in interpretation of your system

"set +m" disables sh's job control.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

NukfrorCommented:
You didn't mention what flavor of *nix you are using.  So I'll discuss Solaris and how it works ... maybe other *nix's are similar.

On Solaris, sh doesn't understand job control.  As such, when a parent forks off a child process its in the same process group as the parent process.  In Solaris, signals are propegated to *all* processes within a process group.  You can see this by playing with sh in an xterm window.  Just fork off a child process that doesn't do anything but loop or something - don't use nohup when forking it to background.  Then in the parent process press <CNTRL>-C, the child process should die - but wait, you did this in the parent process and the child process died !!  Ahhh signal propegation.

Using nohup can sometimes allow a child process to survive when the parent sh process dies - but don't count on it.

On Solaris, You should always use a shell that understands job control (jsh, csh, ksh, bash) and use nohup when forking to background.

<on my soap box>
On one project I was called into, they were using root to startup BEA Weblogic - basically start script did a su to the BEA login to start things up - but the login used sh as the default shell.  They had to do some really CRAZY script hacks so that Weblogic wouldn't die when the su parent process went away.  My 5 second fix - change the default shell to ksh.  Problem disappeared and all the complicated don't-let-the-process-die-script logic was taken out.  8 hour minimum at $200/hr and travel expenses because they wouldn't believe me over the phone.
</on my soap box>
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
java_programmerAuthor Commented:
Hi,

the set +m does nothing .. I am using SCO Unixware 7.1.0 and 7.1.3

The "work around" is to either switch to a different shell (csh for example) or to su - someuser, then su - root then it works (with the same default shell you connect as)

The way our application works, is that I send a message to a "process manager" via IPCS queues, so in theory, I no not physicially start the process, so it gets restarted, again it is indirect.

If I rsh in, it all works ...  if I telnet in , as some user and su to ROOT it works.. what I do not understand is why ssh is giving me a problem, it has to be something specific to the way ssh is creating the initial environment ...

so it comes back down to something weird. Any other ideas?

Thanks,
Derek
0
gheistCommented:
ssh does not use /sbin/login
you cna force it to use that login, but that will posibly cause problems.
0
java_programmerAuthor Commented:
so when I su - root, it uses /sbin/login?
0
gheistCommented:
maybe

read "man login su" to find out.


0
java_programmerAuthor Commented:
Personally I feel that no one has supplied a satifactory answer to my issue. however I will award someone some points since I am forced to
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Networking

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.