How can I delete a user currently logged into XOS?

book

Article ID: 167781

calendar_today

Updated On:

Products

XOS

Issue/Introduction

How can I delete a user currently logged into XOS?When trying to delete a user,  the user is getting this error message. 

XS# configure no username erik
%SYS-ERR: Failed 
Detail: /usr/sbin/userdel: user currently logged in 

Cause

User cannot be deleted from the system if logged in. All sessions must be terminated before removing the user.

Resolution

1. Check for the users configured and verify which user you want to delete.  In this example, we are trying to delete the user "erik".

XS#show usernames
Username  CLI Privilege Level  GUI Access Level  Maxdays  
admin     15                   Administrator     65535    
erik      0                    Guest             30       
(2 rows)

Use "who" command at the unix shell to determine all users logged in.
[[email protected] admin]# who
erik     ttyS0    Feb 27 13:29       <<<<<<<<<<erik is still logged in.
admin    pts/0    Feb 28 08:47 (10.95.0.114)

Use "whoami" command to determine which user your session is logged in as. The current user is also indicated in the prompt. Session of another user can only be terminated by the root user.
[[email protected] admin]# whoami
root
 
2. Terminate all sessions of the user using "pkill" command:

[[email protected] admin]# pkill -KILL -u erik

NOTE: Make sure that no critical processes run under the session which will be terminated.

4.Verify if all sessions for the user has been terminated:
 
[[email protected] admin]# who
admin    pts/0    Feb 28 08:47 (10.95.0.114)

5. Delete the user (there should be no error).
 
#conf no username erik
 
XS# show username        
Username  CLI Privilege Level  GUI Access Level  Maxdays  
admin     15                   Administrator     65535    
(1 row)

Workaround

n/a