Some time ago I wanted to know data on system ports, to know what each one was used for, its utility or function, and I remember that in Wikipedia or some other site I found something about this.
However, some time later I discovered that this information is already in our Linux system, we have it in the file: / etc / services
For example, I leave you a sample (and only a small sample!) Of what it contains:
ftp-data 20 / tcp
ftp 21 / tcp
fsp 21 / udp fspd
ssh 22 / tcp # SSH Remote Login Protocol
ssh 22 / udp
telnet 23 / tcp
smtp 25 / tcp mail
time 37 / tcp timserver
time 37 / udp timserver
rlp 39 / udp resource # resource location
nameserver 42 / tcp name # IEN 116
whois 43 / tcp nicname
As you can see, it shows us the service first, then the port it uses, then the protocol and finally a brief description of some services.
They can show the content of this file by opening it with any text editor, for example in a terminal they could put:
nano /etc/services
Or simply listing the file with:
cat /etc/services
If they want NOT to show all the content, because they only want to know (for example) which port is used for FTP, they can filter with the command grep :
cat /etc/services | grep ftp
And this will give us as a result only what is related to FTP:
ftp-data 20 / tcp
ftp 21 / tcp
tftp 69 / udp
sftp 115 / tcp
ftps-data 989 / tcp # FTP over SSL (data)
ftps 990 / tcp
venus-se 2431 / udp # udp sftp side effect
codasrv-se 2433 / udp # udp sftp side effect
gsiftp 2811 / tcp
gsiftp 2811 / udp
frox 2121 / tcp # frox: caching ftp proxy
zope-ftp 8021 / tcp # zope management by ftp
Well that. That our system often has the information we need, and we are not even aware 😀
regards
Always recommended No. use the default ports. If an unwanted person tries to connect by ssh, the first port they will use will be 22. The same will happen with telnet (I guess no one uses it anymore xD).
regards
However, it is possible to find out which port the service uses.
Of course, it is NOT recommended to use the default ports, at least not in all services. A classic example is SSH, which obviously, although there are correct policies in the firewall, it is always good to change the port. We already explain that here: https://blog.desdelinux.net/configurar-ssh-por-otro-puerto-y-no-por-el-22/
Go my friend, you are great, I see that you satisfied my request, Thank you very much !!!!!, but I need more, although something is better than nothing and I keep waiting for more scripts, I am hungry for knowledge
For some more scripts ... mmm well, check out what we have put here: https://blog.desdelinux.net/tag/bash/
Nice to have SElinux activated: $
SELinux is already another matter, it is certainly recommended for corporate use, but it may be overkill for a home system (well, this depends on the level of "paranoia" of the user).
Gaara, friend, Yes, I have already reviewed that, all very good and I have saved it, only that I was left with the desire to continue learning after… .how to say… ..the first class to make a script and what did you put in https://blog.desdelinux.net/bash-como-hacer-un-script-ejecutable/
exactly 261 days ago ... lol ... I thought I would continue with a consecutive or logical order to continue learning, just that.
After that I put one on if-then-else conditions, look for it there it is.
Go ahead and write an article on the use of cases, it is very useful (I do not do it myself due to lack of time, sorry). By the way, you didn't tell me if the alternative I sent you to the distros detection script was of any use to you.
It's that I ended up just packing in .DEB and that's it, I saved that hahaha, and a friend (son_link) will pack it for Arch, and I'll see how I learn to pack in .RPM 🙂
Yes yes, it served me well, I learned something new hehehehe.
Thanks for sharing the tip! It goes to my mardadores.
Regards. 🙂
Thanks to you for the comment 😀
thanks for the info
It's 1000 xD ports
But with nmap pointing to our static ip, those that are running do not find us and something can enter there?
For example armitage uses nmap to track holes
regards
Yes, with nmap you can know the ports that are open on a computer 🙂
Nice trick, just a comment, no need to pipe cat with grep.
grep ftp / etc / services