Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I am just not sure about the concept. So, I saw a bunch of service in /etc/service, which is provided on my linux box. My question is, if I comment out one of those service, is the port associated with the service still accessible, or it is just a file to associate the quest from on port with only that application?
for example, port 22 is for ssh. If I comment this line out in /etc/service, is port 22 still usable for other applications? Do I have to define that service in /etc/service to use port 22 for that application?
/etc/services is 'just' for number/name translation. So commenting out a service will _not_ close that port or deactivate that service.
If you, for example, do not want ssh access to your box, don't start sshd during startup. How you can do this depends on your distro, but most use links from /etc/rc.d/rc<number>.d/ to /etc/rc.d/init.d (path could be different).
Most applications that you can connect to have default portnumbers (80 for http, 21 for ftp, 22 for ssh etc). Running your own application and using one of these 'reserved' ports is possible but should not be done. Take one of the unassigned numbers (although IANA should officially approve this).
I was looking into /etc/services some time ago and found some references on the
net that provided 'enhanced' versions of this file (ie - it contained additional standard ports). So i copied one of these examples, it was over twice the size of the original one shipped with debian.
But then I came across a reference that said never to update that file, in fact it recommended making /etc/services immutable for security purposes. So i reverted back
to the original. In the security recommendation there was no real reasons given for the importance of this file.
can anyone please shed light?, just curious really.
As mentioned above, it's basically a x-ref text file, but you should never change the port entries with nums < 1024 (Well Known ports), as these are specified by IANA and reserved for root use only (ie only root owned processes can bind to these).
As it says in the file hdr, Registered ports are 1024-49151, so these are reserved for known services if the number has been used.
So long as a number is not registered or you know the std service is not run on this box, you can use that port if you wish.
The upper limit is port num 65535.
You can check out the associated page http://www.iana.org/assignments/port-numbers for more info.