Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
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.
Some time ago, when I was working via SSH on my server, connection was reseted, but session was still hanging on process list. I used kill -9, but it doesn't help enough, 'cause when I'm typing "who" I see them:
Code:
user@machine:~> who
user pts/1 2007-09-07 18:57 (xxx.xxx.xxx.xxx)
root pts/7 2007-09-07 15:00 (xxx.xxx.xxx.xxx)
root pts/8 2007-09-07 15:07 (xxx.xxx.xxx.xxx)
user pts/9 2007-09-07 16:39 (xxx.xxx.xxx.xxx)
user pts/11 2007-07-22 18:53 (xxx.xxx.xxx.xxx)
Some time ago, when I was working via SSH on my server, connection was reseted, but session was still hanging on process list. I used kill -9, but it doesn't help enough, 'cause when I'm typing "who" I see them:
Code:
user@machine:~> who
user pts/1 2007-09-07 18:57 (xxx.xxx.xxx.xxx)
root pts/7 2007-09-07 15:00 (xxx.xxx.xxx.xxx)
root pts/8 2007-09-07 15:07 (xxx.xxx.xxx.xxx)
user pts/9 2007-09-07 16:39 (xxx.xxx.xxx.xxx)
user pts/11 2007-07-22 18:53 (xxx.xxx.xxx.xxx)
How to "kill" them from that list?
To kill and logout a user you could try: skill -KILL -u (username here) or to kill and logout all users try: skill -KILL -v /dev/pts/*
To kill and logout a user you could try: skill -KILL -u (username here) or to kill and logout all users try: skill -KILL -v /dev/pts/*
Thx for your reply {BBI}Nexus{BBI}
Code:
$ skill -KILL -u user
$ who
root pts/1 Sep 10 18:50 (xxx.xxx.xxx.xxx)
root pts/8 Sep 7 15:07 (xxx.xxx.xxx.xxx)
user pts/9 Sep 7 16:39 (xxx.xxx.xxx.xxx)
user pts/11 Jul 22 18:53 (xxx.xxx.xxx.xxx)
root :1/host Sep 3 22:26 (host)
$ ls /dev/pts/
. .. 1 2
Doesn't work. This user isn't logged in from long time, just connection resetted during SSH session and user disconnected from the server, but this session from x days are still hanging in "who"
Try using top to kill the hanging processes. Simply type top in a console (Note: you need to run top as root to kill root processes).
Some useful commands:
u then type username and press enter <-- Only shows info about username specified.
c <-- Shows detailed info about users running processes.
k then type pid number then press enter twice <-- Sends a kill signal with a default value of 15 (If this fails to kill the process, repeat except do not press enter twice, when asked for a value use 9 then press enter).
u then press enter <-- This with no other parameters will show all users and their processes.
q <-- Quits top.
You should also check your settings in your /etc/ssh/ssh_config file for a command which may be keeping your connections alive. Type: man ssh and man ssh_config for further info.
Last edited by {BBI}Nexus{BBI}; 09-10-2007 at 04:20 PM.
The problem is that they aren't hanging in processes list. They stand ONLY in "who" command, nowhere else. I'm thinking how to kill them from there. I've restarted sshd deamon, but didn't help. Is there any way to kill them?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.