?
Solved

Terminating remote sessions

Posted on 2003-02-21
3
Medium Priority
?
798 Views
Last Modified: 2008-02-01
This is a simple question but I am new to linux :)

How can I terminate a remote ssh session to my debian box in the following example:

USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU  WHAT
ian      pts/0    172.16.10.101    00:11    1:26m  0.08s  0.05s  bash
ian      pts/1    172.16.10.101    01:55    0.00s  0.35s  0.02s  w

Any help will be much apreciated.
0
Comment
Question by:ijg0
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 1

Expert Comment

by:Managu
ID: 7998186
Errm, there's a column missing.  Each process listed should have a PID listed too.  If not, you might try fiddling with ps a bit (e.g. try "ps ux").  You might get a listing such as

  PID TTY      STAT   TIME COMMAND
 3001 ?        S      0:00 /usr/sbin/sshd
 3002 pts/1    S      0:00 -bash
 3159 pts/1    R      0:00 ps x

To terminate a process (that you own :), find that process' PID, and then execute the kill command on that.  For instance, if I wanted to kill bash above, I would execute the command:

kill 3002

After that, check to see that it's no longer running.  If your process is still running, you could try

kill -KILL 3002

Which, in all but the most extreme circumstances, will terminate the process.

I should note, for various reasons, you don't want to kill -KILL whenever you don't have to.  Try the first command first.
0
 

Accepted Solution

by:
Cygnus78 earned 80 total points
ID: 7998252
There is no pid information in the output from the command because it is the output from the 'w' command where you see who is logged into the system. in this listing you can see that ian is logged into pts/1 for example. Now you can use the command:

ps aux |grep pts/1

to list all processes on pts/1. Usually there is a process called -bash, and when you kill it you throw the user out. You may need to use the -KILL option ti kill (i think that is the same as -9 ). Be careful though if there are more than the -bash process running you may want to kill them first, or tell the user to finish them himself.

0
 

Author Comment

by:ijg0
ID: 7998750
Thanks Cygnus78. I did need to use the -KILL option as you said to terminate the session.  
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses
Course of the Month7 days, 21 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question