LinuxQuestions.org
Review your favorite Linux distribution.
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 01-14-2003, 08:31 PM   #1
banana2
Member
 
Registered: Dec 2002
Location: Sydney
Distribution: Debian
Posts: 55

Rep: Reputation: 15
Haw to disconnnect user?


my friend is loged on my linux server via ssh ...Haw can i disconnect him...?
 
Old 01-14-2003, 08:53 PM   #2
jdc2048
Member
 
Registered: Jul 2002
Distribution: Redhat, Gentoo, Solaris, HP-UX, etc...
Posts: 391

Rep: Reputation: 30
kill him... and then kill all his children...

1. get his login shell from the /etc/passwd file and
2. then do a "ps -ef | grep <login shell>"
3. search for his id in the output
4. kill -9 <PID>

<edit>
You will also want to remove his ID if you don't want him logging back in.

Last edited by jdc2048; 01-14-2003 at 08:54 PM.
 
Old 01-15-2003, 09:34 AM   #3
NSKL
Senior Member
 
Registered: Jan 2002
Location: Rome, Italy ; Novi Sad, Srbija; Brisbane, Australia
Distribution: Ubuntu / ITOS2008
Posts: 1,207

Rep: Reputation: 47
#!/bin/bash
pgrep -u $1 bash|xargs kill -9

Will help you out do the steps above faster.
Just save is it as a script and run ./kick.sh username, and it'll log out the user, then you can create a lock file not to let any more logons.
HTH
-NSKL
 
Old 01-16-2003, 12:24 PM   #4
jdc2048
Member
 
Registered: Jul 2002
Distribution: Redhat, Gentoo, Solaris, HP-UX, etc...
Posts: 391

Rep: Reputation: 30
That will work if all users use the bash shell. For the most part, this can be assumed on Linux. I just come from a UNIX background, where users use one of 3 major shells (Bourne, Korn, and C Shell).
 
Old 01-16-2003, 09:58 PM   #5
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233

Rep: Reputation: 406Reputation: 406Reputation: 406Reputation: 406Reputation: 406
Quote:
Originally posted by jdc2048
kill him... and then kill all his children...
good one, i assume you meant that to have a double meaning?
 
  


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
Load kde profile from /mnt/removable/user instead of /home/user preacher.ca Linux - General 3 12-02-2005 03:00 PM
newbe question haw do you install stuff and what extion msg4real Linux - Software 6 01-02-2005 08:39 PM
grant user access to /fat-c & copying users' preferences to another user n0x Linux - Newbie 1 07-04-2004 12:04 AM
Games runs slow as normal user, but fast as root user mcore Linux - Software 2 06-07-2004 11:11 PM
Haw can i run my C program in linux?? banana2 Linux - Software 6 02-08-2003 08:06 AM

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

All times are GMT -5. The time now is 01:18 AM.

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