1

I have a question regarding the processes launched via a SSH session, after having performed a su - user. My question applies to RHEL 8, but might as well to other O/S. The SSH connection is initiated from a Windows machine, but the behavior is the same when initiating a SSH connection from any other means.

The use case is the following:

  • log as user via SSH
  • perform
    sudo su - 
    to switch to root
  • execute sleep 3000
  • kill your SSH terminal (like close the mobaxterm window)

In this case, the process sleep 3000 keeps running. This is not specific to the root user. If I switch to the activemq user with su - activemq, I have the same behavior.

However, if I run the command sleep 3000 from the user I used to connect via SSH without performing the su -, killing the SSH terminal also kills the process, as expected.

Is this an expected behavior? And is there a way for this to prevent happening ?

2
  • Please edit your question and clarify that you are connecting from a Windows machine and close the terminal on a Windows machine. Most of us here don't use Windows (I had to look up what this "mobaxterm" thing is). Also, please clarify if this only happens if you switch to another user. What if you run sleep as "user", do you get the same behavior? Commented Oct 22, 2024 at 11:44
  • thanks for the edit, much appreciated. I have added the fact that I don't have the same behavior when running sleep as user, without performing the su - first. Commented Oct 23, 2024 at 13:04

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.