Find the owner shell for a process [closed] - bash

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 9 years ago.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Improve this question
How can I find a process is owned by which shell?
It is useful as I have a server with multiple logged in users and a few long-running processes, and I want to know which users can I force log-out without stopping their started jobs.
The output of ps is reporting a TTY, but it is not useful as even after disowning a job, its TTY remains the same. So how can I find out if a user disown/nohuped its started processes?

You can't find the “owner shell” in the sense you're describing, because there's no such thing. You can find the parent process, which may be a shell; but you can't know whether the shell disowned the job, because that operation is purely internal to the shell.
What you should really do is instruct your users to start long-running programs inside Screen or Tmux. These are somewhat complex programs, but for basic use, they are very simple.
Start a Screen session by running the command screen.
You can run commands inside that session, and they'll keep running even if you log out.
If you want to log out with a command still running, disconnect from the Screen session by typing Ctrl+A D.
To reconnect to an existing Screen session, run screen -rd.
If you exit the shell inside a Screen session, the session exits.
You could perhaps make a wrapper script around long-running processes that starts screen automatically.

Related

Continuosly kill Microsoft Windows processes [closed]

Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed yesterday.
Improve this question
Windows keeps randomly running processes.. and I don't want it to.
Search Indexer (if I deactivate it, Windows will cry in all places that it is deactivated, on the other side, the benefit of Windows Search is negative. It doesn't work, but uses CPU). So I want to keep killing it, without the system complaining that search is deactivated and now.. search which isn't working in any state of windows is "not working".)
Logitech Hub (I sometimes don't want it running, restarts anyways)
and others
So basically I want a bit of control what is running on my Windows Notebook.
I am looking for a script that I start which works with txt list of processes that it kills on a continous basis.
Any ideas?
I tried killing the processes manually, but Windows superseeds my intent.
Ideally it should not be a new tool to install, but rather running cmd in the background

Windows Accounts and processes exploitation [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
Part 1- Do all processes and executables in Windows require an account run and manage them. I was reading how the System account manages the core processes of the OS while service accounts and User accounts manage applications.
Part 2- Do applications or processes that are exploited by any means such as buffer overflow for example and a hacker receives a shell from the exploitation will the shell be under the priveleges of the account that was running the process?
I do not really understand your first question, but yes all the processes have a owner (so a 'user' account in some way...). System is just a particular user in Windows who can basically do anything.
Given a process X which has been run by USER_A, if you're USER_B and exploit the process X with a buffer overflow (or whatever), by controlling this process, you will be able to do everything USER_A can do, so if you launch a shell through the process X, you will have the rights of USER_A in this shell.

How to Exit An App in Terminal While Leaving it Running in Background [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I learned how do to do this in my Linux class last year, but can't for the life of me remember how to do it. I've google searched probably about 30 different combinations of words to try to find out how, but nothing is turning up the correct search.
I'm trying to recall how to close an application (Like pico or emacs) and leave it running in the background.
Additionally, it might be nice to know how to pick that app back up where I left off, which I never learned. Any help would be much appreciated.
When using Bash and some other shells, you can use Ctrl+Z suspend a program then run "fg" to bring it back to the foreground. If you want the program to continue running in the background, typing "bg" will resume the process. If the process prints any output while it's in the background, your display will probably end up being mangled.
For simple commands, instead running your application directly, call it using nohup like this:
nohup ./myScript.sh &
Or alternatively for something like complex like emacs, you can use screen.

Detach running programe from bash [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I'm often in the situation that I run a linux task but then I have to leave the computer or shutdown the notebook, and the task I ran from putty has not finished yet.
Is there a way of I can quit putty and leave the process running 'til it's finished?
I know I can use screen etc, but now I already started the command w/o screen.
(please don't bother too much I didnt directly ask on superuser, serverfault or unix SO.)
Press Ctrl-Z to put the command to background.
Run bg to run it from being suspended.
Then run disown to disown the process from the parent.
It actually also depends on how your command works. Some command exits when it loses its terminal. If that's the case, you can really only just run it with screen or use nohup command </dev/null >/dev/null 2>&1 &.
One way to run it with screen could be screen -dm command.

kill background vs normal process in unix [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I know how to kill a currently running foreground process, e.g.
$kill 15916
What I don't know is what is different about killing a background process.
What's different about killing a background process?
Nothing is different about killing a background task. If you have the process id you can send it a signal (including a terminate or interrupt, as you're doing above)
I'm not sure about your definitions of foreground/background, though. Foreground is the process running in your shell, and your shell is waiting for it to finish before returning control to you. A background task is one that's been disconnected from the shell's input/output. Note that from the process' point of view, it doesn't really have a concept of foreground/background. That's really from the shell's point of view.

Resources