LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-13-2018, 02:25 AM   #16
catiewong
Member
 
Registered: Aug 2018
Posts: 190

Original Poster
Rep: Reputation: Disabled

Quote:
Originally Posted by scasey View Post
Ahh.
Code:
netstat -tnlp
will show you all services that are listening.
Those are the services you'd need to set up on the new server...

Looking at/for ESTABLISHED connections will only tell you which services are being used at the time you take a snapshot. Theoretically that might (probably will) be a subset of the services you need to set up.
thanks , the command you provided may show all connnnected service , but if I would like to know the service in a certain of time has been running , how to check ?
 
Old 12-13-2018, 10:09 AM   #17
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,727

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
Quote:
Originally Posted by catiewong View Post
thanks , the command you provided may show all connnnected service , but if I would like to know the service in a certain of time has been running , how to check ?
That command does NOT show you connected services...it shows you services that are running when you execute the command.
Listening services (servers/daemons) are (usually) running all the time. You should see something like (local address munged)
Code:
netstat -tnlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 192.168.0.26:25         0.0.0.0:*               LISTEN      9114/tcpserver      
tcp        0      0 192.168.0.27:443        0.0.0.0:*               LISTEN      6724/httpd          
tcp        0      0 192.168.0.28:22         0.0.0.0:*               LISTEN      1174/sshd          
tcp        0      0 192.168.0.26:587        0.0.0.0:*               LISTEN      9123/tcpserver      
tcp        0      0 127.0.0.1:3310          0.0.0.0:*               LISTEN      28562/clamd         
tcp        0      0 192.168.0.26:110        0.0.0.0:*               LISTEN      9131/tcpserver      
tcp        0      0 192.168.0.26:143        0.0.0.0:*               LISTEN      15433/dovecot       
tcp        0      0 192.168.0.27:80         0.0.0.0:*               LISTEN      6724/httpd          
tcp        0      0 192.168.0.27:21         0.0.0.0:*               LISTEN      2310/ncftpd
So, I'd need to install the following services on a new server to replicate what's running here:
tcpserver
httpd
sshd
clamd
dovecot
ncftpd

This server uses tcpserver to control the qmail email services running on it, as can be seen by the local port numbers 25, 587, 110 it's using. I know I'd need to install and configure qmail, too, 'cause it's my server and I know what's running on it.
The command on your server would likely show postfix or sendmail or whatever MTA you're running.

Again ESTABLISHED connections only tells you which of those services are connected to a foreign address at the time you run the command.
It does not tell you what you asked for in #14 (finally*), which is to identify which services you need to install on a new server.

*Aside: If you'd stated your actual purpose in your original post, we could have better helped you earlier in the thread.

Last edited by scasey; 12-13-2018 at 10:15 AM.
 
1 members found this post helpful.
Old 12-13-2018, 02:13 PM   #18
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,264
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
Please review the Site FAQ for guidance in posting your questions and general forum usage. Especially, read the link in that page, How To Ask Questions The Smart Way. The more effort you put into understanding your problem and framing your questions, the better others can help!

scasey's answer in post#15 tells you what are now asking for, which is in fact very different than what you asked in your original post.

Please be respectful of the time volunteered by others to provide answers by putting more effort into understanding your own requirements before asking your questions.
 
1 members found this post helpful.
Old 12-16-2018, 11:55 AM   #19
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,727

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
catiewong: No more responses?
It would be polite to at least acknowledge the help you've received...
One other thought: The command
Code:
systemctl | grep running
Will show you all the services that are currently running, including those that do not "LISTEN" at a port.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to log internal-sftp chroot jailed users access log to /var/log/sftp.log file LittleMaster Linux - Server 0 09-04-2018 03:45 PM
Time out in Connection established state if no Data flows on that connection asurya Linux - Networking 2 04-10-2005 03:54 PM
How to detect that a dial-up Internet connection was established? zeppelin Programming 3 09-28-2003 05:11 AM
Will select fail if connection couldn't be established? ruchika Linux - Software 0 09-10-2003 11:39 AM
problems with established connection nbc Linux - Newbie 1 08-16-2001 01:11 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration