LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > AIX
User Name
Password
AIX This forum is for the discussion of IBM AIX.
eserver and other IBM related questions are also on topic.

Notices

Reply
 
Search this Thread
Old 01-02-2009, 12:23 AM   #1
vathsan
Member
 
Registered: May 2008
Posts: 46

Rep: Reputation: 15
Post shell script to automatically kill user on a server


Hi All

I work as a AIX administrator maintaining 20 AIX servers. We create NIS users on a single server which spreads user accounts on other servers. I would want to restrict a particular user from logging into a specific workstation. This is not acheivable as the user account was created using NIS and the user account is common to other servers/workstations.

Please let me know how I can effectively stop the users from logging into a particular server which he/she should not access.

Alternatively, can we write a shell script which monitors particular user account logins and automatically kills user's process on the particular workstation and put this is cron for repititive action.
Kindly, help me in suggesting a shell script to acheive this request.


Thanks in advance!

- Vathsan.
 
Old 01-02-2009, 05:51 AM   #2
zQUEz
Member
 
Registered: Jun 2007
Distribution: Fedora, RHEL, Centos
Posts: 294

Rep: Reputation: 53
You didn't mention how this person is logging on, so I am going to assume they are logging on via SSH.
Therefore what about using the "DenyUsers" option under /etc/ssh/sshd_config ?

Another option (and I am not the strongest AIX admin), but you could have a script that runs every so often that checks /etc/security/user and adds the line "login = false" under the code block for this particular user.

If you wanted to go the route of killing the active user, you could ps for the sshd of the user login name, and then kill that PID.
 
Old 01-05-2009, 10:50 PM   #3
vathsan
Member
 
Registered: May 2008
Posts: 46

Original Poster
Rep: Reputation: 15
Hi

Thanks for your wonderful inputs. I managed to fix the issue by writing a small shell script to monitor username and to kill the process.

ps -aef | grep <username> | awk '{printf("kill -9 %d\n",$2)}' | sh

I was not able to find any entries on /etc/ssh/sshd_config to mention Denyusers in the file. Also, the user is not specific to particular server (ie. NIS user) so user's information will not be available in /etc/security/users file.


Cheers!

- Vathsan.
 
Old 01-06-2009, 03:22 AM   #4
zQUEz
Member
 
Registered: Jun 2007
Distribution: Fedora, RHEL, Centos
Posts: 294

Rep: Reputation: 53
DenyUsers is an option that isn't mentioned in the default sshd_config, though is in the man page.
However, if you're happy with the ps monitoring script then that is what counts.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
kill the process invoked from a shell script, when the script is killed kskkumar Linux - Software 8 05-23-2007 11:29 AM
Shell Script to kill a process automaticaly brazilian_user Programming 11 06-12-2006 09:09 PM
shell script to kill all processes on specified port varunbihani Linux - General 1 04-19-2005 05:39 AM
Kill a process launched by a shell script gsbarry Programming 7 01-06-2004 02:09 PM


All times are GMT -5. The time now is 11:02 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration