LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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!

Notices


Reply
  Search this Thread
Old 10-28-2014, 11:10 AM   #1
snowman83
LQ Newbie
 
Registered: Oct 2014
Posts: 2

Rep: Reputation: Disabled
Shell script to find running services, installed applications/programs and ports.


Hello Folks,

I am looking for a shell script which would provide me with following output:- Running services on a linux host, installed applications/programs, install location and the ports on which they are running.

I am using Red Hat Linux.

Can someone please help me out with this script? Its very urgent and we need to use it on a production server.

Regards.
 
Old 10-28-2014, 11:23 AM   #2
snowman83
LQ Newbie
 
Registered: Oct 2014
Posts: 2

Original Poster
Rep: Reputation: Disabled
Shell script to find out all connected hosts.

Hello Folks,

One of my friend works on a Red Hat linux box. He is looking for a shell script which can provide me with all hosts which connected to that particular linux box (using ssh), date and time of connection, mode of connection, port etc.
Basically a script which can give all information on who has been talking to that linux box for past few months.

Can anyone please help with such a shell script? Its very urgent and they intend to use the same on their production server. Please confirm.

Regards.
 
Old 10-28-2014, 11:46 AM   #3
Soadyheid
Senior Member
 
Registered: Aug 2010
Location: Near Edinburgh, Scotland
Distribution: Cinnamon Mint 17.3 and 18.2 at present.
Posts: 1,293

Rep: Reputation: 301Reputation: 301Reputation: 301Reputation: 301
Have you tried asking Red Hat? If you're using it in a production environment you're surely paying them for support?

I'd reckon not doing so is an unacceptable risk to your customers should you have some sort of catastrophic failure.

Perhaps you should be running Centos, the "free" equivalent instead.

Be lucky, you may need it!

 
Old 10-28-2014, 12:26 PM   #4
netnix99
Member
 
Registered: Jun 2011
Distribution: redhat, CentOS, OpenBSD
Posts: 298

Rep: Reputation: 98
I don't know that you really need a script for that. I would personally just check out the log files.

/var/log/secure - shows remote connections, type of connection, username, date, time

and if you run the command:
Code:
last | more
You can see who all has been logged in, for how long, if they are still logged in, dates/time for the logins, and IP/hostname of originating connection.

If you are needing to create reports with this data, you can use simple commands (grep, sed, awk, etc.) to grab the data and redirect to a file.


HTH
 
Old 10-28-2014, 11:10 PM   #5
vipinsqa
Member
 
Registered: Oct 2014
Posts: 40

Rep: Reputation: Disabled
Hi,

Thanks for the revert. Actually, we do not have any support available from RedHat. I just need a script so that I can run it on the server (one of them is a production server) and get the information on running services, installed applications/programs, install location and ports etc.
Please help me with a script which provides me with these kind of details.

Regards.
 
Old 10-28-2014, 11:16 PM   #6
vipinsqa
Member
 
Registered: Oct 2014
Posts: 40

Rep: Reputation: Disabled
Hi,

Thanks for the revert. Actually, we do not have any support available from RedHat. I just need a script so that I can run it on the server (one of them is a production server) and get the information on running services, installed applications/programs, install location and ports etc.
Please help me with a script which provides me with these kind of details.

Regards.
 
Old 10-28-2014, 11:30 PM   #7
vipinsqa
Member
 
Registered: Oct 2014
Posts: 40

Rep: Reputation: Disabled
Hi,

Thanks for the revert.
I need the information on all hosts which connected to the linux box:- Their IP address (hostname), date/time of connection, type of connection, username etc.
Is it possible to get all this information in /var/log/secure? I can see and realise that the secure log generally breaks down after a limit, so how can I retrieve entries from this log and which column represents which field?

Would appreciate if someone can help me with a script.

Regards.
 
Old 10-29-2014, 02:47 AM   #8
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 9,779

Rep: Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888
duplicate of http://www.linuxquestions.org/questi...ox-4175523546/
 
Old 10-29-2014, 03:19 AM   #9
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,411

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
We'd like to see what you've written so far, but you could start with the netstat cmd...
 
Old 10-29-2014, 03:21 AM   #10
AnanthaP
Member
 
Registered: Jul 2004
Location: Chennai, India
Distribution: UBUNTU 5.10 since Jul-18,2006 on Intel 820 DC
Posts: 849

Rep: Reputation: 201Reputation: 201Reputation: 201
http://www.tldp.org/LDP/Linux-Filesy.../html/var.html

would be a place to start.

OK
 
Old 10-29-2014, 05:37 AM   #11
eklavya
Member
 
Registered: Mar 2013
Posts: 622

Rep: Reputation: 136Reputation: 136
Run the command :
Code:
last | grep "still"
Edit:
I haven't posted my answer here. Actually this is not the same question either.
It was about find logged in users.

Last edited by eklavya; 10-30-2014 at 12:56 AM.
 
Old 10-29-2014, 07:23 AM   #12
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 9,779

Rep: Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888
I do not think you can use any general solution, because there is no general solution to this issue. There are a lot of different services with different (strange?) configurations and there can be a lot of local customizations, specialized daemons ....
rpm -q can be used to check officially installed packages, but there can be other apps too.
 
Old 10-29-2014, 05:42 PM   #13
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. I took the liberty to merge the two next to identical threads.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
the configure shell script of gtimer find that GTK+ is incorrectly installed elaich Linux - Software 1 11-08-2011 05:56 PM
How do I find which services are installed &/or running on my Ibex? DarkFlame Linux - Server 6 01-13-2009 11:25 PM
run a shell script on remote client from a server to find all its running process robin singh Linux - Newbie 7 10-03-2008 12:32 PM
Nmapfe, open ports, and running services jrdioko Linux - Security 20 09-04-2004 04:25 PM
how 2 get ports having services currently running 00it45 Linux - General 5 03-11-2004 08:59 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:32 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration