LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-01-2009, 09:50 PM   #1
KFC123
Member
 
Registered: May 2009
Posts: 47

Rep: Reputation: 15
terminate all sessions


Hi there,
I have a server running CentOS which allows user to logon remotely with ssh. As root, how can I write a script to terminate all session started by other users other than root?
 
Old 07-01-2009, 10:40 PM   #2
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
I'm not going to write your script for you but I will say that key components of such a script would be the kill utility and the killall utility.
Code:
man kill
man killall

Last edited by stress_junkie; 07-01-2009 at 10:57 PM.
 
Old 07-01-2009, 11:46 PM   #3
lazlow
Senior Member
 
Registered: Jan 2006
Posts: 4,363

Rep: Reputation: 172Reputation: 172
Assuming root is local, just shutdown the nics (dirty, but quick and effective).
 
Old 07-03-2009, 02:16 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Yep, if root is on the console then

service network stop

would do it, but a bit of a blunt instrument.

service sshd stop

is better.

I think you can tweak the sshd config and bounce sshd.??
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ps does not terminate Lotharster Linux - Newbie 1 02-18-2006 09:03 AM
How to terminate this command slpwkr Programming 4 03-28-2005 11:33 AM
How to terminate X application? drj000 Linux - Software 1 02-10-2005 07:40 PM
how to terminate processes feetyouwell Programming 8 09-18-2004 02:27 PM
How can I terminate an application? yangyiqi Linux - Software 7 12-10-2003 06:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:59 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