LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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


Reply
  Search this Thread
Old 11-02-2005, 05:20 PM   #1
Verbal Kint
Member
 
Registered: Apr 2004
Posts: 99

Rep: Reputation: 15
Kicking Users


Hello,

[root@linux jeff]# w
18:23:53 up 6 days, 17:36, 3 users, load average: 0.08, 0.06, 0.01
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/1 on.xxxxxxx.com 12:46 0.00s 51.43s 0.02s w
root pts/2 on.xxxxxxx.com 12:48 1:47m 0.10s 0.10s -bash
ensabac pts/3 xxxxxxxxxx 18:23 3.00s 0.08s 0.08s -bash

I am new and was hoping somone can tell me how to boot a user (ensabac) that is logged in via ssh?

Thanks
 
Old 11-02-2005, 05:27 PM   #2
TBC Cosmo
Member
 
Registered: Feb 2004
Location: NY
Distribution: Fedora 10, CentOS 5.4, Debian 5 Sparc64
Posts: 356

Rep: Reputation: 43
kill the pid associated with the bash session of the user.
 
Old 11-02-2005, 05:43 PM   #3
Verbal Kint
Member
 
Registered: Apr 2004
Posts: 99

Original Poster
Rep: Reputation: 15
Thanks but can someone tell me how to do that?
 
Old 11-02-2005, 06:17 PM   #4
TBC Cosmo
Member
 
Registered: Feb 2004
Location: NY
Distribution: Fedora 10, CentOS 5.4, Debian 5 Sparc64
Posts: 356

Rep: Reputation: 43
You see that ensebac has psuedo terminal 3 pts/3. So do a ps -ef and filter for pts/3 and filter again for ssh. Then kill -9 the process id for that session.

1. ps -ef|grep pts/3|grep ssh
2. note the pid
3. kill -9 [pid]

OR

Code:
kill -9 `ps -ef|grep pts/3|grep [s]sh|awk '{print $2}'`
 
Old 11-02-2005, 06:49 PM   #5
Verbal Kint
Member
 
Registered: Apr 2004
Posts: 99

Original Poster
Rep: Reputation: 15
Great that worked using:

#kill -9 `ps -ef|grep pts/3|grep [s]sh|awk '{print $2}'`

Now one thing I am curious about---------->I tried the #1 you said to get the pid:

[root@linux ~]# ps -ef|grep pts/3|grep ssh
ensabac 23441 23439 0 19:52 ? 00:00:00 sshd: ensabac@pts/3
[root@linux ~]#

You said "note the pid" and just do a "#kill (pid)".......Where is the pid above?

Thanks!
 
Old 11-02-2005, 07:33 PM   #6
TBC Cosmo
Member
 
Registered: Feb 2004
Location: NY
Distribution: Fedora 10, CentOS 5.4, Debian 5 Sparc64
Posts: 356

Rep: Reputation: 43
23441 would be the pid. If you do a plain old ps -ef, the top line will have a description of the fields

Code:
[radar@localhost ~]$ ps -ef
UID        PID  PPID  C STIME TTY          TIME CMD
root         1     0  0 Oct17 ?        00:00:00 init [5]
root         2     1  0 Oct17 ?        00:00:00 [ksoftirqd/0]
root         3     1  0 Oct17 ?        00:00:00 [events/0]
root         4     1  0 Oct17 ?        00:00:00 [khelper]
 
Old 11-02-2005, 08:29 PM   #7
Verbal Kint
Member
 
Registered: Apr 2004
Posts: 99

Original Poster
Rep: Reputation: 15
cool, thanks!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Kicking Users coindood Linux - General 2 03-10-2004 08:25 AM
Kicking users question dtugg Linux - Networking 0 02-23-2004 06:41 PM
kicking out users im1crazyassmofo Linux - General 4 06-21-2003 08:16 PM
I would like a virtual a$$ kicking... Whitehat General 11 04-13-2003 12:29 AM
Proftpd kicking users unique3 Linux - Software 0 02-26-2003 10:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:53 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration