Logoff a user...


 
Thread Tools Search this Thread
Operating Systems AIX Logoff a user...
# 1  
Old 11-29-2005
Error Logoff a user...

Hi...

could anyone tell me how to kill a user session on my server with out affecting other user?

Bala
# 2  
Old 11-29-2005
I use this to grab their PID :
ps -ef | grep userid
Then kill -kill PID
# 3  
Old 11-30-2005
thank for the reply..

is there any other command other than killing that particular userid?

Bala
# 4  
Old 12-01-2005
Quote:
Originally Posted by balaji_prk
thank for the reply..

is there any other command other than killing that particular userid?

Bala
You do not "kill the userid", but kill the login session she is using. Instead of using "ps -fe | grep <userid>" you can also use "ps -fu <userid>" btw., which lists all processes owned by the specified userid.

bakunin
# 5  
Old 12-03-2005
hi bakunin

the method u explained is correct.. But i will explain the scenario..
suppose at any instance when i run the who command and i found an unauthorized user logged in to my server and i should log him out at the earliest. what am i supposed to do? i know his username... so is there any command by which i could kill his session using his username? sorry if am stupid...

Bala
# 6  
Old 12-04-2005
I don't get it - if a user has a userid she is supposed to be authorized, yes?

If you want to disable the ability of a userid to log in, but still want to keep the userid you can disable his right to log on to the machine. The information rests in the ODM and can be listed with the "lsuser" and changed with the "chuser" command. Here is a sample output of "lsuser":

Code:
# lsuser f985905
f985905 id=23996 pgrp=staff groups=staff,system,security,ddm001r home=/home/f985905 shell=/usr/bin/ksh 
gecos=myuser, CS3 AIX-Administration Team login=true su=false rlogin=true daemon=true admin=true 
sugroups=ddm001r,ALL tpath=on ttys=ALL expires=0 auth1=SYSTEM auth2=NONE umask=77 registry=files SYSTEM=files 
loginretries=5 pwdwarntime=14 account_locked=false minage=0 maxage=13 maxexpired=0 minalpha=1 
minother=1 mindiff=3 maxrepeats=2 minlen=7 histexpire=0 histsize=9 fsize=2097151 cpu=-1 data=131072 
stack=32768 core=1024 rss=32768 nofiles=2000 core_hard=1024 time_last_login=1133704370 
time_last_unsuccessful_login=1133183860 tty_last_login=ssh tty_last_unsuccessful_login=/dev/pts/1 
host_last_login=130.24.110.41 host_last_unsuccessful_login= unsuccessful_login_count=0 roles=ManageBasicUsers,ManageAllUsers,ManageBasicPasswds,ManageAllPasswds,ManageRoles,ManageBackupRestore,ManageBackup,ManageShutdown,RunDiagnostics,ManageDiskQuota

I have marked bold the parts which are interesting to you. By setting any of these values appropriately you can lock the user out of the machine:

Code:
# chuser -a login=false f985905
# chuser -a account_locked=true f985905
...etc

This would, of course only prevent further logins, to get the user out of the machine immediately look up her processes by ps -fu like mentioned above and kill these processes. In the example above that would be:

Code:
# ps -fu f985905
     UID    PID   PPID   C    STIME    TTY  TIME CMD
 f985905 581780 696398   0 14:53:02  pts/1  0:00 -ksh 
 f985905 671978 729222   0 14:52:50  pts/0  0:00 -ksh 
 f985905 729222 811062   0 14:52:50      -  0:00 sshd: f985905@pts/0 
 f985905 696398         1   0 13:27:22  pts/2  0:00 -ksh 
# kill -9 696398

Hope this helps

bakunin

Last edited by bakunin; 12-04-2005 at 07:44 PM..
# 7  
Old 12-05-2005
That really helped... Thanks a lot...
Well I have got one more doubt and am posting it as a new thread,
so that it helps.

Bala
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Ubuntu

Blank Screen after logoff server via vnc Viewer.

Hello All, I have installed VNC Server on Ubuntu system to access this system from windows machine i'm using VNC Viewer. When i logged off the server from windows machine through VNC Viewer its showing blank screen only... Kindly help. Regards, Purushottam Aher (0 Replies)
Discussion started by: purushottamaher
0 Replies

2. Shell Programming and Scripting

My script stops after logoff...why??

Hi' i am runing a script thats run with a loop...while loop true. when i exit the server..logon and again the script doenst run. its a bash script test.sh. i run it as: #./test.sh & what can be the priblem please? thanks alot (6 Replies)
Discussion started by: zigizag
6 Replies

3. Shell Programming and Scripting

Case Statement for Login/Logoff Script

I'm currently trying to write a login script. I have already written a logoff script that uses an if/else statement. #!/bin/bash TIMED=$(date +%H) if ' then echo Have a Great Day $USER else echo Have a Great Night $USER fi But I'd like to write one that give me the option of... (1 Reply)
Discussion started by: bbowers
1 Replies

4. Shell Programming and Scripting

Logon/Logoff script

I need help for writing a logon/logoff script for recording user's computer usage time. This is for local login only, not for ssh or something like that. When a user logon, there should be a temp file (/home/acct/login_temp) generated including the logname and logon time information in the... (8 Replies)
Discussion started by: jimx
8 Replies

5. AIX

Track user logoff in AIX 5.3

Hi Does anybody know if there is a way in AIX 5.3 to track how a user was logged off? For instance where the user typed exit, hit crtl D, shell process was killed, etc. I know of the last log entries but this just shows a users login time and duration. I also tried syslog but I only get login... (5 Replies)
Discussion started by: kimyo
5 Replies

6. UNIX for Advanced & Expert Users

Running a script during logoff

I know we can put whatever we need to run during login inside /etc/profile or .profile file. I want to run a set of commands before logoff. Where should I put my commands/scripts? Is such facility available? (3 Replies)
Discussion started by: praveenkumar_l
3 Replies

7. Shell Programming and Scripting

list the names of users who logoff in last 4 minutes

i am new to unix shell program, please someone hint me how to get the names of users who make logouts in last 4 minutes? i dont need complete script, but only the guide (2 Replies)
Discussion started by: jax_anchal
2 Replies

8. SCO

Apparent logoff’s due to inactivity.

I have run across an issue with the last two Dell Poweredge servers I have attempted to deploy. I seems that when a telnet session sits idle for 5 to 30 minutes (seems random) the session is being closed and users are logged off. If the session has user activity there is no problem staying... (0 Replies)
Discussion started by: gadgetman
0 Replies

9. UNIX for Dummies Questions & Answers

logoff idle user script

Will someone please share a script with me that will read in each line of the who -u output and if idle time is more than 50 min, execute a kill on the PID? This is what I have so far: who -u | cut -c 40-56 I am comfortable in the korn shell, but I can broaden my horizons if you've got... (4 Replies)
Discussion started by: michieka
4 Replies

10. UNIX for Dummies Questions & Answers

logoff ghost user

I just noticed by running a who command that I was logged in twice . So two admin2 are on the list. (solaris 2.6) Since I telnet using a windows 98, I suppose that I forgot to CTRL-D last time I logged in and clicked on hangup. In such a case, how can I loggoff the old ghost loggin ? It's not a... (4 Replies)
Discussion started by: phpote
4 Replies
Login or Register to Ask a Question