clear ssh
To terminate an incoming or outgoing Secure Shell (SSH) connection, use the clear ssh command in EXEC mode.
clear ssh {session-id | outgoing session-id}
Syntax Description
session-id |
Session ID number of an incoming connection as displayed in the show ssh command output. Range is from 0 to 1024. |
outgoing session-id |
Specifies the session ID number of an outgoing connection as displayed in the show ssh command output. Range is from 1 to 10. |
Command Default
None
Command Modes
EXEC modeCommand History
Release |
Modification |
---|---|
Release 2.0 |
This command was introduced. |
Usage Guidelines
Use the clear ssh command to disconnect incoming or outgoing SSH connections. Incoming connections are managed by the SSH server running on the local networking device. Outgoing connections are initiated from the local networking device.
To display the session ID for a connection, use the show ssh command.
Task ID
Task ID |
Operations |
---|---|
crypto |
execute |
Examples
In the following example, the show ssh command is used to display all incoming and outgoing connections to the router. The clear ssh command is then used to terminate the incoming session with the ID number 0.
RP/0/RP0/CPU0:router# show ssh
SSH version: Cisco-2.0
session pty location state userid host ver
--------------------------------------------------------------------
Incoming sessions
0 vty0 0/33/1 SESSION_OPEN cisco 172.19.72.182 v2
1 vty1 0/33/1 SESSION_OPEN cisco 172.18.0.5 v2
2 vty2 0/33/1 SESSION_OPEN cisco 172.20.10.3 v1
3 vty3 0/33/1 SESSION_OPEN cisco 3333::50 v2
Outgoing sessions
1 0/33/1 SESSION_OPEN cisco 172.19.72.182 v2
2 0/33/1 SESSION_OPEN cisco 3333::50 v2
RP/0/RP0/CPU0:router# clear ssh 0
The following output is applicable for the clear ssh command starting IOS-XR 5.3.2 releases and later.
RP/0/RP0/CPU0:router# show ssh
SSH version : Cisco-2.0
id chan pty location state userid host ver authentication connection type
--------------------------------------------------------------------------------------------------------------------------
Incoming sessions
0 1 vty0 0/RSP0/CPU0 SESSION_OPEN lab 12.22.57.75 v2 rsa-pubkey Command-Line-Interface
0 2 vty1 0/RSP0/CPU0 SESSION_OPEN lab 12.22.57.75 v2 rsa-pubkey Command-Line-Interface
0 3 0/RSP0/CPU0 SESSION_OPEN cisco 12.22.57.75 v2 rsa-pubkey Sftp-Subsystem
1 vty7 0/RSP0/CPU0 SESSION_OPEN cisco 12.22.22.57 v1 password Command-Line-Interface
3 1 0/RSP0/CPU0 SESSION_OPEN lab 12.22.57.75 v2 password Netconf-Subsystem
4 1 vty3 0/RSP0/CPU0 SESSION_OPEN lab 192.168.1.55 v2 password Command-Line-Interface
Outgoing sessions
1 0/RSP0/CPU0 SESSION_OPEN lab 192.168.1.51 v2 password
RP/0/RP0/CPU0:router# clear ssh 0