Category Archives: Linux Administration

Raspberry Pi 3 error IPTables | Raspberry pi error – iptables v1.4.21: can’t initialize iptables table `nat’: Table does not exist (do you need to insmod?)

Was building a RPi3 machine and got the following error after an update.

Turns out nothing to worry about, just reboot the Pi.

Nextcloud 13 – 14 Error, Missing Appstore | nextcloud missing availible applications

I encountered an error yesterday which stopped the availible application being displayed on both my Nextcloud 13 and 14 installations.

It turns out to be a bug which can be fixed by inserting the following line into the installdir/config/config.php file.

The entire file should look something like this.

 

Setup a central rsyslog server Howto | Setup a central log server

This document has the instructions required to setup a centralized log server. This should be a minimum requirement for all organizations. A must have tool for intrusion prevention and detection.

Server Setup

Install rsyslog and vim text editor.

Edit the configuration file.

Ensure the configuration file has the following enabled.

Restart the service to allow the change of configuration to take effect.

The following command “netstat” will check to see which ports are open on the system and listening. Port 514 should be open and listening, waiting for logs to be shipped from the client.

If the above ports appear open, then the server configuration is operating correctly.

 

Client Setup

Let install rsyslog and vim text editor

Edit config file.

Appending the following line to the end of the configuration file. Ensure you change the IP address of the forward to the IP address of the rsyslog server configured earlier.

Restart rsyslog to allow the changes to take effect.

To test, issue the following command and tail the logs of the rsyslog server.

You should see the above quoted line appear on the servers logs.

 

 

Setup a backup job for your LAMP sites. | Setup a backup job for your LAMP sites.

I wrote a script which takes a backup of my webserver, taking a snapshot of all the website content, database, and configuration files.

Theory is if the webserver died, we would be about to result quickly using the data backed up.

On the server, put the following script and below is the cron entry which triggers every week. You will need up change the username and password for your mysql server.

This is the cron entry which fires up every friday.

Now this script will be on a linux machine somewhere else, it will connect and copy the backup archive file generated. You must first setup the ssh key so that its passwordless connection.

Simplicity it key! It works and will get you out of trouble. Well worth the 5minute investment.

 

 

Error when installing VLC on Fedora Core 27 | Error when installing VLC on Fedora Core 27

Got the following error when installing VLC on Fedora Core 27.

The correct way to install VLC on any FC new then 22 is,

This will work.

Simple way to backup your MySQL database everyday! | backup your mysql database everyday with this bash script.

This is a simple script to backup your MySQL database everyday and compress it on the fly, you just need to add an entry into Cron. see below

Script

The script will also data the new backup which stops it overriding the previous backup.

Edit cron

Enter this

This will kick off everyday at 9:22pm

Building a useful .ssh/config file for your SSH connections | setup to configure your .ssh/config file!

Writing a good ssh config file can make your life a whole lot easier especially if your an Linux Admin.

I have written a basic config file below which should be saved in the following location “~/.ssh/config”, when attempting to ssh its the first place SSH looks for instructions by default.

After the config if will go through in detail explain what each line does.

Host: this is like an alias, it will once you attempt to ssh to it, it will resolve using the Hostname field.

Hostname: Look above

Port: The port the ssh server is running on

User: the username you have on the server

Identityfile: This is your SSH private key location

ForwardX11: This is to allow you to see an X GUI session from the remote computer.

Keepalive: the next three are to enable keepalive which will ensure your SSH session stays active even after a period of inactivity. The two subsequent options enable you to configure the frequency of the keepalive packets.

Compression: this enables compression, this is especially useful over slow links. You will need to do more research for the senario which suits your connection and security requirements.

DynamicForward: This enables you to tunnle your connection to the remote host on the specified port. Simply setup your browser on socks5 proxy and point to localhost:port.

LocalForward: This enables you to setup tunneling. Simply specify your local reserved port and your remote IP and port which you want tunneled.

Finding deleted text on a Linux system using Grep | finding deleted text files using grep

I ran across a neat little trick when attempted to recover a deleted file on my Linux box.

You can use grep to search your disk at a bit level for a deleted file, on the condition you know a string in its contents.

You can test it like this, write a text file and store a specific string in it. ie

then insert something like

then delete the file.

Now lets find the deleted file.

Your missing file should appear with a bit of junk above and below the contents of your file.

Increase the lines in the -B10 -A10 depending how big your file it.

 

 

Get an email when your public IP changes | get notified when your public ip changes.

Alot of us have ISPs which change your IP address and you may not want to setup a client with a dynamic IP or want a backup in case the services fails.

So i developed a bash script which checks to see if your public IP has changed. If it has it will log it and email you the new IP.

See below.