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 |
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
11-02-2005, 05:20 PM
|
#1
|
|
Member
Registered: Apr 2004
Posts: 99
Rep:
|
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
|
|
|
|
11-02-2005, 05:27 PM
|
#2
|
|
Member
Registered: Feb 2004
Location: NY
Distribution: Fedora 10, CentOS 5.4, Debian 5 Sparc64
Posts: 352
Rep:
|
kill the pid associated with the bash session of the user.
|
|
|
|
11-02-2005, 05:43 PM
|
#3
|
|
Member
Registered: Apr 2004
Posts: 99
Original Poster
Rep:
|
Thanks but can someone tell me how to do that?
|
|
|
|
11-02-2005, 06:17 PM
|
#4
|
|
Member
Registered: Feb 2004
Location: NY
Distribution: Fedora 10, CentOS 5.4, Debian 5 Sparc64
Posts: 352
Rep:
|
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}'`
|
|
|
|
11-02-2005, 06:49 PM
|
#5
|
|
Member
Registered: Apr 2004
Posts: 99
Original Poster
Rep:
|
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!
|
|
|
|
11-02-2005, 07:33 PM
|
#6
|
|
Member
Registered: Feb 2004
Location: NY
Distribution: Fedora 10, CentOS 5.4, Debian 5 Sparc64
Posts: 352
Rep:
|
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]
|
|
|
|
11-02-2005, 08:29 PM
|
#7
|
|
Member
Registered: Apr 2004
Posts: 99
Original Poster
Rep:
|
cool, thanks!
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 04:51 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|