Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,150,704 members, 7,809,681 topics. Date: Friday, 26 April 2024 at 12:59 PM

How To Monitor File Changes On Web Server - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / How To Monitor File Changes On Web Server (8437 Views)

Google Changes Search Engine Logo / Google Is Now Alphabet: Search Giant Changes Name / If U Want Changes On Nairaland Website What Do U Want (2) (3) (4)

(1) (Reply) (Go Down)

How To Monitor File Changes On Web Server by Slyr0x: 1:11pm On Aug 01, 2013
Yesterday, I was trying to help a client fix a hacked site and one of the controls I put in place was to monitor changes to files on the web server. . So I'll just explain how you can also do same (either you are on a shared-hosting or dedicated server provided it's a LINUX box).

Over time when malicious hackers hit your site, they've been known to drop a backdoor somewhere on your server. It could be the /css , /images , /admin/images, /js , /includes directories . .somewhere far hidden from you.

To check for recent file changes on your webserver, you can do this

1. If you have SSH access, fire up Putty and run this command

find /home/xxxxxxxxx/public_html -type f -ctime -1 -exec ls -ls {} \;

Make sure /home/xxxxxxxxx/public_html is the full path to your public_html,www, httpdocs directory

2. Setup a cron job

- Login to your cPanel
- Under "Advanced" submenu, you will see "Cron Jobs". Click it
- Tweak the settings to suit you (either you want alerts hourly/daily/weekly)
- There is a section for "Commands", type in
find /home/xxxxxxxxx/public_html -type f -ctime -1 -exec ls -ls {} \;
- Click "Add New Cron Jobs"


This will NOT prevent files from being changed without your knowledge. However, if a file is added or changed, you will get an email alert telling you which file was changed.


Cheers.

6 Likes

Re: How To Monitor File Changes On Web Server by Nobody: 2:39pm On Aug 01, 2013
Great!!!

not everyone can use the command line though

Their is a PHP script that you can install on you site. It notifies you if there are any changes to your site -- sending an email with a list of changed files. This at least tells you where to look. it also has a wordpress plugin

Read more
www.webchicklet.com/tools/monitorhackdfiles-tool-helps-fight-site-hackers/


You could set up a Google Alert http://www.google.com/alerts to search your site for probable junk. For example, you might have the alert search for "viagra site:example.com". Google alerts will email you if it ever finds the target of your search.

2 Likes 1 Share

Re: How To Monitor File Changes On Web Server by spikesC(m): 3:25pm On Aug 01, 2013
I don't know but script changes occurs almost every time on servers's i've worked with.
I thought it would probably be anti-virus scans or something but i am sure that getting email alerts when ever a files changes last modification time is a total waste of resources.

BTW, always reupload all your website files once in a while. There's one time one a few files in one of my sites got missing sad

1 Like

Re: How To Monitor File Changes On Web Server by Slyr0x: 3:42pm On Aug 01, 2013
ActiveMan: Great!!!

not everyone can use the command line though

Their is a PHP script that you can install on you site. It notifies you if there are any changes to your site -- sending an email with a list of changed files. This at least tells you where to look. it also has a wordpress plugin

Read more
www.webchicklet.com/tools/monitorhackdfiles-tool-helps-fight-site-hackers/


You could set up a Google Alert http://www.google.com/alerts to search your site for probable junk. For example, you might have the alert search for "viagra site:example.com". Google alerts will email you if it ever finds the target of your search.

Nice one. Thanks for your contribution
Re: How To Monitor File Changes On Web Server by Slyr0x: 3:45pm On Aug 01, 2013
spikes C: I don't know but script changes occurs almost every time on servers's i've worked with.
I thought it would probably be anti-virus scans or something but i am sure that getting email alerts when ever a files changes last modification time is a total waste of resources.

No, it's not.

Please educate me: Are there scripts that Auto-change?
Re: How To Monitor File Changes On Web Server by mitey(m): 3:59pm On Aug 01, 2013
Slyr0x:
spikes C:
I don't know but script changes occurs almost every time on servers's i've worked with.
I thought it would probably be anti-virus scans or something but i am sure that getting email alerts when ever a files changes last modification time is a total waste of resources.
No, it's not.

Please educate me: Are there scripts that Auto-change?


I was thinking the same thing. Is it not only the DB that changes all the time?

1 Like

Re: How To Monitor File Changes On Web Server by spikesC(m): 5:13pm On Aug 01, 2013
I use inmotionhosting and i've worked on ipage.
I use dreamweaver for web development. To upload files to my server, i use the synchronise button so that only the files i changed on my development environment gets uploaded.
Now sometimes, when i try uploading files, it prompts that the file have been modified on the remote server, and if i want to upload or not.
I've checked and there's no modification at all.

So, i can only assume that there's something reading and resaving the files on my server. Antiviruses can do that, backups and server changes does that, if you have a load balancer, you'll definitely experience it. So, like i said, it would be a total waste of resources for me.
I can only suggest you use a file comparism software or chmod your files not to be automatically overwritten by a script
Re: How To Monitor File Changes On Web Server by Slyr0x: 3:26pm On Aug 02, 2013
spikes C:
So, i can only assume that there's something reading and resaving the files on my server. Antiviruses can do that, backups and server changes does that, if you have a load balancer, you'll definitely experience it. So, like i said, it would be a total waste of resources for me.

Reading and Writing are TOTALLY different.

Antivirus scanners can scan your files, read the content for signatures etc. . .but they will NEVER write to your files.

Any attempt to edit/change your files without your knowledge is termed "malicious".

spikes C: So, like i said, it would be a total waste of resources for me.

Better safe than sorry bro smiley

3 Likes

Re: How To Monitor File Changes On Web Server by andreagoffi1978: 3:36pm On Nov 28, 2016
I tried both solution, find with cron and php script monitorhackdfiles-tool, but unfortunately neither work on my cheap hosting.

I think it's due to the fact that my hosting is windows based and the find command can't be executed.

For now, I found the https://monitorwebsitefilechanges.cloud/ service that essentially does the same thing, but it also works on my windows hosting. The only flaw is that it costs $2.5 per month.

Do you know other solutions, maybe free, that work for windows hosting?
Re: How To Monitor File Changes On Web Server by serverconnect(m): 7:18am On Nov 29, 2016
GOOD ONE.
Re: How To Monitor File Changes On Web Server by Achorise: 7:19am On Nov 29, 2016
Good morning my nairalanders, Please click likes for me to wish me happy birthday.
Re: How To Monitor File Changes On Web Server by escapefromusa(f): 7:20am On Nov 29, 2016
Run mdhas after every successful logout if ur paranoid , use python + SQLite
Re: How To Monitor File Changes On Web Server by Nobody: 7:21am On Nov 29, 2016
Something is missing in that command, how does it send an email alert. Very informative post by the way.
What about Windows servers?
Re: How To Monitor File Changes On Web Server by PhonePlanet(m): 7:23am On Nov 29, 2016
Dear my fellow Nigerian, A directive has been sent out by the Nigerian Communication Commission(NCC) to all telecommunication network in Nigeria. This will result in increase of data rates which will take effect from 1st of December, 2016. I am very sure your service provider has notified you about this development already.
In this year and time we live in, Data is suppose to be more affordable and not more expensive. And looking at the ease/advantages the internet has added to our everyday life, increment of data rates will only make it harder to access the internet thereby taking us backwards instead of forward.
Therefore, In disagreement with this move by NCC and telecommunication companies, we have made an effort stop this from taking effect by creating an online petition at Change.org and we need you to sign it to show your support. The link to the petition is: https://www.change.org/p/nigeria-communication-commission-ncc-data-plans-rates-by-carriers-in-nigeria-should-not-be-increased-by-ncc?recruiter=642402116&utm_source=share_petition&utm_medium=copylink
Please I already believe you would sign this petition to show your support for us and against NCC. But you also have to share/re-broadcast this message to as many people as you can. Thank you as you do so.
Re: How To Monitor File Changes On Web Server by nasfem22(m): 8:08am On Nov 29, 2016
andreagoffi1978:
I tried both solution, find with cron and php script monitorhackdfiles-tool, but unfortunately neither work on my cheap hosting.

I think it's due to the fact that my hosting is windows based and the find command can't be executed.

For now, I found the https://monitorwebsitefilechanges.cloud/ service that essentially does the same thing, but it also works on my windows hosting. The only flaw is that it costs $2.5 per month.

Do you know other solutions, maybe free, that work for windows hosting?

windows server?? what hosting is that??
Re: How To Monitor File Changes On Web Server by sakalisis(m): 9:13am On Nov 29, 2016
Good
Re: How To Monitor File Changes On Web Server by AkProsper(m): 10:04am On Nov 29, 2016
Thank for the info. but seriously, KOYEMI.
does it apply to blog or website
Re: How To Monitor File Changes On Web Server by AfricaDiet: 11:27am On Nov 29, 2016
Niceone
Re: How To Monitor File Changes On Web Server by manmidtexy(m): 11:55am On Nov 29, 2016
Nice Post. can you design and debvelop a simple website with sub-domain ?

chat me up at 08064721908 -- whatsapp.
Re: How To Monitor File Changes On Web Server by lanchy: 1:52pm On Nov 29, 2016
andreagoffi1978:
I tried both solution, find with cron and php script monitorhackdfiles-tool, but unfortunately neither work on my cheap hosting.

I think it's due to the fact that my hosting is windows based and the find command can't be executed.

For now, I found the https://monitorwebsitefilechanges.cloud/ service that essentially does the same thing, but it also works on my windows hosting. The only flaw is that it costs $2.5 per month.

Do you know other solutions, maybe free, that work for windows hosting?

Windows solution uses Powershell. Run this Powershell script for Windows https://gallery.technet.microsoft.com/scriptcenter/Powershell-FileSystemWatche-dfd7084b

It will monitor folder and can send smtp email notifications as an events trigger.
Re: How To Monitor File Changes On Web Server by lanchy: 2:00pm On Nov 29, 2016
Slyr0x:
Yesterday, I was trying to help a client fix a hacked site and one of the controls I put in place was to monitor changes to files on the web server. . So I'll just explain how you can also do same (either you are on a shared-hosting or dedicated server provided it's a LINUX box).

Over time when malicious hackers hit your site, they've been known to drop a backdoor somewhere on your server. It could be the /css , /images , /admin/images, /js , /includes directories . .somewhere far hidden from you.

To check for recent file changes on your webserver, you can do this

1. If you have SSH access, fire up Putty and run this command



Make sure /home/xxxxxxxxx/public_html is the full path to your public_html,www, httpdocs directory

2. Setup a cron job

- Login to your cPanel
- Under "Advanced" submenu, you will see "Cron Jobs". Click it
- Tweak the settings to suit you (either you want alerts hourly/daily/weekly)
- There is a section for "Commands", type in
- Click "Add New Cron Jobs"


This will NOT prevent files from being changed without your knowledge. However, if a file is added or changed, you will get an email alert telling you which file was changed.


Cheers.

If you like, I can teach/show you how to set up a monitoring solution using Linux server, which you can sell to your clients as a monitoring service, it will be able to give them monthly reports on compute resource usage (CPU/RAM/Network)/user access/site traffic volumes......using free Linux software to accomplish it all....Interested!? Contact me directly.
Re: How To Monitor File Changes On Web Server by pacespot(m): 7:00pm On Nov 29, 2016
Thank you OP for this invaluable post, though I haven't tested it but I believe it'll become useful when I start scrutinizing American predators from my web server.

Americans are a mess of internet-based business nowadays, you wouldn't believe they constitute over 70 percent of visitors to my website but I haven't gotten a single client or earn a cent from their visits yet. They will rather send me email embedded with malicious code or spam comment expecting me to click on the link to get access into my private information.

I have gotten a few clients from Asians; Indians and Taiwan especially, despite being less than ten percent of visitors to my website. In fact, if I have a way to redirect all my traffic from America to Asian countries in my webmaster section, I'll quickly do that with glee. But Google only allows you to target one particular country at a time in the "Target Geography" section, not continent.

If you're a website owner and still targeting American audience nowadays, sorry to say, but sorry is your name.

http://www.socialmediaverve.com
Re: How To Monitor File Changes On Web Server by Newbiee: 7:17pm On Nov 29, 2016
Hmmmm! NAIRALAND don go high tech.
Re: How To Monitor File Changes On Web Server by pacespot(m): 7:17pm On Nov 29, 2016
Slyr0x:
Yesterday, I was trying to help a client fix a hacked site and one of the controls I put in place was to monitor changes to files on the web server. . So I'll just explain how you can also do same (either you are on a shared-hosting or dedicated server provided it's a LINUX box).

Over time when malicious hackers hit your site, they've been known to drop a backdoor somewhere on your server. It could be the /css , /images , /admin/images, /js , /includes directories . .somewhere far hidden from you.

To check for recent file changes on your webserver, you can do this

1. If you have SSH access, fire up Putty and run this command [
/b]



Make sure [b]/home/xxxxxxxxx/public_html
is the full path to your public_html,www, httpdocs directory

2. Setup a cron job

- Login to your cPanel
- Under "Advanced" submenu, you will see "Cron Jobs". Click it
- Tweak the settings to suit you (either you want alerts hourly/daily/weekly)
- There is a section for "Commands", type in
- Click "Add New Cron Jobs"


This will NOT prevent files from being changed without your knowledge. However, if a file is added or changed, you will get an email alert telling you which file was changed.


Cheers.

Hello OP @ the bolded, how do I "fire up putty and run the command?"
Re: How To Monitor File Changes On Web Server by GreatManBee: 9:23pm On Nov 29, 2016
Slyr0x:
Yesterday, I was trying to help a client fix a hacked site and one of the controls I put in place was to monitor changes to files on the web server. . So I'll just explain how you can also do same (either you are on a shared-hosting or dedicated server provided it's a LINUX box).

Over time when malicious hackers hit your site, they've been known to drop a backdoor somewhere on your server. It could be the /css , /images , /admin/images, /js , /includes directories . .somewhere far hidden from you.

To check for recent file changes on your webserver, you can do this

1. If you have SSH access, fire up Putty and run this command



Make sure /home/xxxxxxxxx/public_html is the full path to your public_html,www, httpdocs directory

2. Setup a cron job

- Login to your cPanel
- Under "Advanced" submenu, you will see "Cron Jobs". Click it
- Tweak the settings to suit you (either you want alerts hourly/daily/weekly)
- There is a section for "Commands", type in
- Click "Add New Cron Jobs"


This will NOT prevent files from being changed without your knowledge. However, if a file is added or changed, you will get an email alert telling you which file was changed.


Cheers.

(1) (Reply)

How Can I Make My Blog To Show On Opera Mini News Feed / Classical Ways Of Promoting A New Blog Post / Best School Management System For Primary And Secondary School - SDOSMS

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 51
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.