Tuesday, August 27, 2019

SSH and Netstat tricks for linux users

ssh - secure shell runs on port 22 (by default).


The OpenSSH is the most common implementation of SSH, which allows you to do the same which telnet, FTP or rlogin can do. However, the advantage of using OpenSSH is its encryption technology implemented using algorithms such as DES, 3DES, Blowfish,etc. One thing you must be kept in mind that OpenSSH is not a protocol, it’s just a set of program that uses SSH protocol to improvise the ssh protocol features.



1. sudo netstat -i
This will show all the interfaces.

2.
To check if SSH service is running ?
rajesh@rajesh-laptop:~$ sudo netstat -tupln | grep ssh
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      29209/sshd


3.
rajesh@rajesh-laptop:~$ sudo netstat -tunp
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name   
tcp        0      0 192.168.1.115:33344     52.7.54.80:443          ESTABLISHED 2889/chrome --type=
tcp        0      0 127.0.0.1:55371         127.0.0.1:4369          ESTABLISHED 880/beam.smp       
tcp        0      0 192.168.1.115:39786     54.86.111.152:443       ESTABLISHED 2889/chrome --type=
tcp        0      0 192.168.1.115:48942     104.16.158.106:443      TIME_WAIT   -                 
tcp        0      0 192.168.1.115:47236     20.189.78.37:443        ESTABLISHED 2365/rajesh --pid=2
tcp        0      0 127.0.0.1:55269         127.0.0.1:4369          TIME_WAIT   -                 
tcp        0      0 192.168.1.115:51520     54.209.137.253:443      ESTABLISHED 2889/chrome --type=
tcp        0      0 192.168.1.115:44374     74.125.130.188:5228     ESTABLISHED 2889/chrome --type=
tcp        0      0 192.168.1.115:33760     52.114.75.78:443        ESTABLISHED 2365/rajesh --pid=2
tcp        0      0 192.168.1.115:39720     34.195.30.94:443        ESTABLISHED 2889/chrome --type=
tcp        0      0 192.168.1.115:58140     13.224.21.109:443       ESTABLISHED 2889/chrome --type=
tcp        0      0 192.168.1.115:47308     20.189.78.37:443        ESTABLISHED 2365/rajesh --pid=2
tcp        0      0 192.168.1.115:43078     178.128.122.9:443       TIME_WAIT   -                 
tcp        0      0 192.168.1.115:43772     13.224.17.218:443       ESTABLISHED 2889/chrome --type=
tcp        0      0 192.168.1.115:48432     34.225.241.187:443      ESTABLISHED 2889/chrome --type=
tcp        0      0 192.168.1.115:60824     172.217.167.197:443     ESTABLISHED 2889/chrome --type=
tcp        0      0 192.168.1.115:56912     151.101.120.84:443      ESTABLISHED 2889/chrome --type=
tcp6       0      0 127.0.1.1:4369          127.0.0.1:42783         TIME_WAIT   -                 
tcp6       0      0 127.0.0.1:4369          127.0.0.1:55371         ESTABLISHED 878/epmd           
tcp6       0      0 192.168.1.115:57081     13.75.106.0:443         ESTABLISHED 2634/Preload.js --b
udp        0      0 192.168.1.115:49999     74.125.130.189:443      ESTABLISHED 2889/chrome --type=
udp        0      0 192.168.1.115:41943     172.217.194.189:443     ESTABLISHED 2889/chrome --type=
udp        0      0 192.168.1.115:38174     216.58.200.174:443      ESTABLISHED 2889/chrome --type=
udp        0      0 192.168.1.115:36252     172.217.167.35:443      ESTABLISHED 2889/chrome --type=
udp        0      0 192.168.1.115:41715     172.217.167.46:443      ESTABLISHED 2889/chrome --type=


This show all the TCP and UDP connections with the program name and port

No comments:

Post a Comment