Hack 16. SSH Session Statistics using SSH Escape Character

by Ramesh

To get some useful statistics about the current ssh session, do the following. This works only on SSH2 client.

1. Login to remotehost from localhost.

  1. localhost$ ssh -l jsmith remotehost

2. Display SSH statistics

On the remotehost, type ssh escape character ~ followed by s as shown below. This will display lot of useful statistics about the current SSH connection.

  1. remotehost$ [Note: The ~s is not visible on the command line when you type.]
  2.  
  3. remote host: remotehost
  4. local host: localhost
  5. remote version: SSH-1.99-OpenSSH_3.9p1
  6. local version: SSH-2.0-3.2.9.1 SSH Secure Shell (non-commercial)
  7. compressed bytes in: 1506
  8. uncompressed bytes in: 1622
  9. compressed bytes out: 4997
  10. uncompressed bytes out: 5118
  11. packets in: 15
  12. packets out: 24
  13. rekeys: 0
  14. Algorithms:
  15. Chosen key exchange algorithm: diffie-hellman-group1-sha1
  16. Chosen host key algorithm: ssh-dss
  17. Common host key algorithms: ssh-dss,ssh-rsa
  18. Algorithms client to server:
  19. Cipher: aes128-cbc
  20. MAC: hmac-sha1
  21. Compression: zlib
  22. Algorithms server to client:
  23. Cipher: aes128-cbc
  24. MAC: hmac-sha1
  25. Compression: zlib
  26.  
  27. localhost$