This article discusses the different options to logout sessions manually, with a specific scenario where the same user is logged in simultaneous sessions.
Sessions can logout/close on the basis of PID [process ID], terminal or username. All users can also logout together using the 'all' option. These options are mentioned below:
root@device> request system logout ?
Possible completions:
<[Enter]> Execute this command
all Logout all sessions owned by user
pid Management process ID for user
terminal Terminal user is logged in to
user Name of user
| Pipe through a command
Sometimes, the same user may open simultaneous multiple sessions. These sessions share the same username. The fastest method to logout these sessions is using the 'terminal' option.
Example:
-
Get the list of active sessions logged-in to the SRX using the command 'show system users
'. Then select the terminal session you want to logout manually.
root@device> show system users
8:11PM up 16 days, 9:11, 4 users, load averages: 7.35, 7.19, 7.36
USER TTY FROM LOGIN@ IDLE WHAT
root v0 - 29Aug20 7days cli
root pts/0 10.107.106.42 8:11PM - -cs
root pts/1 10.107.106.42 8:09PM - cli
root pts/2 10.107.106.42 8:09PM 2 cli
-
Notice the TTY value for the session to manually logout. The session is logged out using the command 'request system logout terminal <TTY Value>
'.
root@device> request system logout terminal pts/0
logout-user: done
-
The selected session is logged out.
root@device> show system users
8:16PM up 16 days, 9:16, 3 users, load averages: 7.56, 7.29, 7.34
USER TTY FROM LOGIN@ IDLE WHAT
root v0 - 29Aug20 7days cli
root pts/1 10.107.106.42 8:09PM - cli
root pts/2 10.107.106.42 8:09PM 6 cli
This is applicable to all Junos devices. For further details, refer to the command reference guide for
request system logout.