Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi, it happens once in a while that I log into my server, and then for some reason the connection is reset. I log in again, and see two "root" users; one which is the current session, the other which is the old session that got disconnected.
So my question is how to kill one of those sessios? I've tried killing pid of the user's ssh and bash, but to no avail. I finger my machine (I'm so immature) and still see both usernames there. Is there another way to kill one of the users, without rebooting?
Originally posted by ziphem Hi, it happens once in a while that I log into my server, and then for some reason the connection is reset. I log in again, and see two "root" users; one which is the current session, the other which is the old session that got disconnected.
So my question is how to kill one of those sessios? I've tried killing pid of the user's ssh and bash, but to no avail. I finger my machine (I'm so immature) and still see both usernames there. Is there another way to kill one of the users, without rebooting?
Thanks!!
This is what happens if a connection is lost, without properly logging out. You just kill the pid of the old bash.
if "kill <pid>" fails do "kill -9 <pid>" to send a sigkill instead of a sigterm signal. (sigterm can be ignored or caught by a process. Sigkill cannot be caught).
I used to have this problem with my university account. My INTERNET connections was bad, and sometimes It disconnected me. So in order to make the administrator's life easier, i logged back in and killed by myself the old processes.
Alternatively issue a <who -u>, this will list users logged on along with the pid then do a kill -15 <pid> doing kill -9 straight away may not kill all processes for the user.
Originally posted by benjithegreat98 I just have to say that I love the title of your post. As a sysadmin I feel the same way sometimes!
A 9mm is lightweight and easy to conceal, and is quiet as far as real handguns go, but if you know how to build a silencer you can probably do it with a 357 in only one shot and not garner too much unwanted attention. Just make sure you hide the body well afterward.
Seriously though - if you have multiple bash sessions running on that user's tty, you want to kill the bash process with the lowest PID.
Hehehehe thanks a lot for the response. The -15 didn't work, but the -9 did. Huh. The H&K USP .45 also did the trick, I tried that after kill -15 and before the -9. Ok seriously though, this is great, I've been trying to do this forever. I'm the only user, so it's just killing a session that got disconnected but still shows as active on the system rather than always rebooting.
Thanks very much again everyone for the quick answers, I really appreciate it.
Originally posted by ziphem Hehehehe thanks a lot for the response. The -15 didn't work, but the -9 did. Huh. The H&K USP .45 also did the trick, I tried that after kill -15 and before the -9. Ok seriously though, this is great, I've been trying to do this forever. I'm the only user, so it's just killing a session that got disconnected but still shows as active on the system rather than always rebooting.
Thanks very much again everyone for the quick answers, I really appreciate it.
Doing kill <pid> is the same as doing kill -15 <pid>. Kill is a command that sends a signal to a process. By default kill sends SIGTERM (the signal with value 15). Do
Code:
man 7 signal
to see all the existing signals. What you did is what the shutdown scripts in Linux/UNIX do. They send a SIGTERM(15) to all processes, they wait for a few seconds to let the processes end properly, and then they send a SIGKILL(9) signal, to terminate all the processes that did ignore the SIGTERM. If you pay attention to the output printed when your computer shuts down you'll notice it.
Quote:
Originally posted by benjithegreat98 I just have to say that I love the title of your post. As a sysadmin I feel the same way sometimes!
I've never been a sysadmin, but I know how you feel...Some people just should never be allowed to touch a keyboard.
Guns work... sure. But have you ever cleaned cerebellum out of a keyboard? You just never know how a round object, as empty as the typical user's head, is going to react to the rapid introduction of a metal slug.
This is why my LART of choice is a classic oak "billie." This short club (a little over two feet in length) has the solid strength needed to put a user out of their misery for 20-30 minutes with one good blow. When further education is needed, it takes only a couple more blows to introduce a nice coma-like state. And for the final level of education, a good dozen blows to the cranium is not only effective but it strangely satisfying.
There is just no feeling like that of a user's head caving like a rotten pumpkin under the firm blows from your LART. It is that satisfaction which keeps me from the projectile weapons.
My question would be, why are you logging directly in as root in the first place? Setup sudo or su if needed. And disable finger if your on a network...
And about the losing the connection to this server, run screen, it'll save you a lot of hassle. When you disconnect, you can reconnect and connect back to the same session you were on before.
*bleep* all that we've got to get on with these
Gotta compete with the wily Japanese
There's too many home fires burning
and not enough trees
so *bleep* all that
We've got to get on with these!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.