iWatch realtime filesystem monitoring for Linux

iWatch is a realtime filesystem monitoring tool for Linux. Its purpose is to monitor any changes in a specific directory or file and send email notification immediately after the change. This can be very useful to watch a sensible file or directory against any changes, like files /etc/passwd,/etc/shadow or directory /bin or to monitor the root directory of a website against any unwanted changes.

Features:

  •     run in command line mode as well as in daemon mode
  •     using an easy xml configuration file
  •     can watch directory recursively and watch new created directory
  •     can have a list of exceptions
  •     can use regex to compare the file/directory name
  •     can execute command if an event occurs
  •     send email
  •     syslog
  •     print time stamp

Suppose you want to watch the change in /etc filesystem, you just need to run it in the console

$ iwatch /etc

If you want to be notified per email:

$ iwatch -m [email protected] /etc

More Details and Download/instructions:
http://iwatch.sourceforge.net/index.html

 

Backing up & Restoring Permissions in Linux

The easiest way is to use getfacl and setfacl which can be installed with a quick apt-get install acl. getfacl will display all the permissions of the directory and it’s files which you can output to a file.

You can then use setfacl to set the permissions reset them from a backup of the outout from the getfacl command.

Examples:
Backup permission settings:

getfacl -R /var/www/html/website > websiteperms.txt

Restore permission settings:

cd /var/www/html/website
setfacl --restore=/home/ubuntu/websiteperms.txt

More examples in this post: https://ausinfotech.net/blog/backup-and-restore-permissions-in-linux/

Creating NGINX Rewrite Rules

How to create NGINX rewrite rules (the same methods work for both NGINX Plus and the open source NGINX software). Rewrite rules change part or all of the URL in a client request, usually for one of two purposes:

  • To inform clients that the resource they’re requesting now resides at a different location. Example use cases are when your website’s domain name has changed, when you want clients to use a canonical URL format (either with or without the www prefix), and when you want to catch and correct common misspellings of your domain name. The return and rewrite directives are suitable for these purposes.
  • To control the flow of processing within NGINX and NGINX Plus, for example to forward requests to an application server when content needs to be generated dynamically. The try_files directive is often used for this purpose.

Example of a redirect to a new domain name:

<code>server { listen 80; listen 443 ssl; server_name www.old-name.com; return 301 $scheme://www.new-name.com$request_uri; }

Read more details and examples from the Nginx blog post: https://www.nginx.com/blog/creating-nginx-rewrite-rules/

 

Linux Dash

A simple web dashboard to monitor your linux systems.

Features:

  • A beautiful, simple web-based dashboard for monitoring a linux server
  • Only ~1MB on disk! (.git removed)
  • Live graphs, refresh-able widgets, and a growing # of supported modules
  • Drop-in installation for PHP, Node.js, Python, and Go

More details and downloads:
http://linuxdash.afaqtariq.com/
https://github.com/afaqurk/linux-dash

 

Email Checker

Email Checker is a simple tool for verifying an email address. It’s free and quite easy to use. Just enter the email address and hit check button. Then it tells you whether the email address is real or not. It extracts the MX records from the email address and connect to mail server (over SMTP and also simulates sending a message) to make sure the mailbox really exist for that user/address. Some mail servers do not co-operate in the process, in such cases, the result of this email verification tool may not be accurate as expected.

http://email-checker.net/

 

Boot-Repair Utility and Methods

Boot-Repair is a simple tool to repair frequent boot issues you may encounter in Ubuntu like when you can’t boot Ubuntu after installing Windows or another Linux distribution, or when you can’t boot Windows after installing Ubuntu, or when GRUB is not displayed anymore, some upgrade breaks GRUB, etc.

Boot-Repair lets you fix these issues with a simple click, which (generally reinstalls GRUB and) restores access to the operating systems you had installed before the issue.

Boot-Repair also has advanced options to back up table partitions, back up bootsectors, create a Boot-Info (to get help by email or forum), or change the default repair parameters: configure GRUB, add kernel options (acpi=off …), purge GRUB, change the default OS, restore a Windows-compatible MBR, repair a broken filesystem, specify the disk where GRUB should be installed, etc.

More Information and link:
https://help.ubuntu.com/community/Boot-Repair

 

Linux – Copy file to multiple dir

How an I copy a file into multiple directories? You could write a script or just use these commands from the terminal in bash.

Copy test.txt into dir1,dir2,an dir3 dirs:

 echo dir1 dir2 dir3 | xargs -n 1 cp -v test.txt 

Copy test.txt into /dir/d1, /dir/d2, and /dir/d3 dirs:

 echo /dir/d{1,2,3} | xargs -n 1 cp -v test.txt