Linux Tutorial | Matt Cooper - Open Source Support
Linux Tutorial | Matt Cooper - Open Source Support
Debian Tutorial

SSH Login without Password

Generate auth keys:

ssh-keygen -t rsa

Copy public key (id_rsa.pub) to destination server:

ssh-copy-id root@10.10.10.10

*Or manually insert key from id_rsa.pub (host) into /root/.ssh/authorized_keys (destination)

Now try shelling from the host machine to the destination e.g.

ssh root@10.10.10.10

You shouldn’t be asked for a password and dropped straight into the server.

September 11, 2015by Matt Cooper
FacebookTwitterPinterestGoogle +Stumbleupon
Debian Tutorial, Ubuntu Tutorial

Format and Mount a hard drive larger than 2TB Ubuntu

Find the drive name:

fdisk -l

*In this example we will use /dev/sdc

Now access parted to prepare the drive for formatting and mounting:

sudo parted /dev/sdc

Now set the following:

(parted) mklabel gpt
(parted) unit TB
(parted) mkpart primary 0.00TB 4.00TB (Changing 4.00TB to the size of your drive)
(parted) quit

Continue reading

September 2, 2015by Matt Cooper
FacebookTwitterPinterestGoogle +Stumbleupon
Wordpress Troubleshooting

WordPress – disable RSS feed

If like me you have issues with a blog duplicating/stealing your blog posts and the following to your WordPress theme’s functions.php (Appearance > Editor):

remove_action('do_feed_rdf', 'do_feed_rdf', 10, 1);
remove_action('do_feed_rss', 'do_feed_rss', 10, 1);
remove_action('do_feed_rss2', 'do_feed_rss2', 10, 1);
remove_action('do_feed_atom', 'do_feed_atom', 10, 1);

This disables the /feed form your website and hopefully stops content being duplicated by other ‘bloggers’ through a plugin.

You can also ask Google to remove the URLs from searches if a copyright infringement here:

http://www.google.com/webmasters/tools/dmca-notice?rd=1

August 17, 2015by Matt Cooper
FacebookTwitterPinterestGoogle +Stumbleupon
MySQL Tutorial

MySQL check databases and email log bash script

Place the following script in a directory of your choice:


#<?bash
#!/bin/bash
#
# #automysqlcheck.sh
#
# This is a small bash script that checks all mysql databases for errors
# and mails a log file to a specified email address. All variables are
# hardcoded for ease of use with cron. Any databases you wish not to check
# should be added to the DBEXCLUDE list, with a space in between each name.
#
# Note that DBEXCLUDE will only work with GNU sed, as BSD regular expressions
# on Darwin seem to have some trouble with word boundary anchors.
#
# original version by sbray@csc.uvic.ca, UVic Fine Arts 2004
#
# modified by eyechart AT gmail.com (see Change Log for details)
#
# Some of this code was inspired from automysqlbackup.sh.2.0
# http://sourceforge.net/projects/automysqlbackup/
#
#=====================================================================
# Change Log
#=====================================================================
#
# VER 1.1 - (2005-02-22)
# Named script automysqlcheck.sh
# Added PATH variable to make this script more CRON friendly
# Removed the $DBTABLES loop and replaced it with single command
# that executes the CHECK TABLE command on all tables in a given DB
# Changed code to only check MyISAM and InnoDB tables
# Cleaned up output to make the email prettier
# Modified script to skip databases that have no tables
# VER 1 - (2004-09-24)
# Initial release by sbray@csc.uvic.ca
# system variables (change these according to your system)
PATH=/usr/local/bin:/usr/bin:/bin:$PATH
USER=username
PASSWORD=password
DBHOST=localhost
LOGFILE=/var/log/automysqlcheck.log
MAILTO=email@domain.com
TYPE1= # extra params to CHECK_TABLE e.g. FAST
TYPE2=
CORRUPT=no # start by assuming no corruption
DBNAMES="all" # or a list delimited by space
DBEXCLUDE="" # or a list delimited by space

# I/O redirection...
touch $LOGFILE
exec 6>&1
exec > $LOGFILE # stdout redirected to $LOGFILE

echo -n "AutoMySQLCheck: "
date
echo "---------------------------------------------------------"; echo; echo

# Get our list of databases to check...
# NOTE: the DBEXCLUDE feature seemed to only work with Linux regex, GNU sed
if test $DBNAMES = "all" ; then
DBNAMES="`mysql --user=$USER --password=$PASSWORD --batch -N -e "show databases"`"
for i in $DBEXCLUDE
do
DBNAMES=`echo $DBNAMES | sed "s/\b$i\b//g"`
done
fi

# Run through each database and execute our CHECK TABLE command for all tables
# in a single pass - eyechart
for i in $DBNAMES
do
# echo the database we are working on
echo "Database being checked:"
echo -n "SHOW DATABASES LIKE '$i'" | mysql -t -u$USER -p$PASSWORD $i; echo

# Check all tables in one pass, instead of a loop
# Use GAWK to put in comma separators, use SED to remove trailing comma
# Modified to only check MyISAM or InnoDB tables - eyechart
DBTABLES="`mysql --user=$USER --password=$PASSWORD $i --batch -N -e "show table status;" \
| gawk 'BEGIN {ORS=", " } $2 == "MyISAM" || $2 == "InnoDB"{print $1}' | sed 's/, $//'`"

# Output in table form using -t option
if [ ! "$DBTABLES" ]
then
echo "NOTE: There are no tables to check in the $i database - skipping..."; echo; echo
else
echo "CHECK TABLE $DBTABLES $TYPE1 $TYPE2" | mysql -t -u$USER -p$PASSWORD $i; echo; echo
fi
done

exec 1>&6 6>&- # Restore stdout and close file descriptor #6

# test our logfile for corruption in the database...
for i in `cat $LOGFILE`
do
if test $i = "warning" ; then
CORRUPT=yes
elif test $i = "error" ; then
CORRUPT=yes
fi
done

# Send off our results...
if test $CORRUPT = "yes" ; then
cat $LOGFILE | mail -s "MySQL CHECK Log [ERROR FOUND] for $DBHOST-`date`" $MAILTO
else
cat $LOGFILE | mail -s "MySQL CHECK Log [PASSED OK] for $HOST-`date`" $MAILTO
fi
#?>

*Make sure to update user, password, dbhost, log file location and DBNAMES/DBEXCLUE with your own details.

Now make the script executable (chmod +x scriptname.sh) and add a cronjob to run when required e.g.

01 20 * * * /home/user/bin/mysqlcheckscript.sh

*cron will run at 1.20am everyday.

August 17, 2015by Matt Cooper
FacebookTwitterPinterestGoogle +Stumbleupon
ISPConfig3 Tutorial

Add SRV Record to Ispconfig3

A customer asked me to add a SRV record to their domain but documentation on how to add this record is very slim.

To add the SRV record:

1. Open the zone file > Records > Select SRV:

SRV Record

2. Enter the record details similar to the following (insert your own records):

srv_filled

3. You will notice there is no option to set priority. To do this we need to modify the DNS record in the database. Navigate to your phpmyadmin (e.g. http://10.10.10.10/phpmyadmin). Lookup the domain in the dns_rr table and edit the record, changing aux to the priority value (100 in this case):

 

phpmyadmin_srv

4. That’s everything in place now perform a lookup with MX Toolbox:

srv_report

 

August 14, 2015by Matt Cooper
FacebookTwitterPinterestGoogle +Stumbleupon
Page 20 of 35« First...10«1819202122»30...Last »

About me

Hi, I'm Matt Cooper. I started this blog to pretty much act as a brain dump area for things I learn from day to day. You can contact me at: matt@linuxtutorial.co.uk

Recent Comments

  • Andrew on Export list of Amazon EC2 Instances to CSV
  • Matt Cooper on Proxmox – add a second hard drive to node for Backups
  • karis on Proxmox – add a second hard drive to node for Backups
  • Matt Cooper on Remote MySQL Database – Slow Connection
  • Matt Cooper on Bash script to send public IP address to Email

Categories

  • AdvancedTomato
  • Amazon AWS
  • Amazon Linux
  • Amazon S3
  • Apache
  • Apache Kafka
  • Backup Tutorial
  • Bash Scripting
  • Centos Tutorial
  • CloudFlare
  • Command line Tutorial
  • CPanel Troubleshooting
  • CPanel Tutorial
  • Debian Troubleshooting
  • Debian Tutorial
  • DKIM
  • Docker
  • EC2
  • ESXi
  • Faildows
  • Google Adwords
  • Google Analytics
  • Google Chromebook
  • Google Mail
  • graylog
  • IAM
  • imapsync
  • iRedmail Tutorial
  • ISPConfig3 Tutorial
  • Java
  • ldap
  • letsencrypt
  • MyDNS
  • MySQL Troubleshooting
  • MySQL Tutorial
  • Nest Install
  • Netbeans
  • Nginx
  • Nginx Troubleshooting
  • openssl
  • PCI Compliance
  • Percona
  • PHP
  • Plex Media Server Tutorial
  • Postfix
  • Proxmox Tutorial
  • Pure FTPd
  • Resourcespace Tutorial
  • Route 53
  • Rsync Tutorial
  • Security
  • Smoothwall Troubleshooting
  • Smoothwall Tutorial
  • SSH
  • tcpdump
  • Thunderbird
  • Tomcat Troubleshooting
  • Ubuntu Tutorial
  • Uncategorized
  • Unison
  • vmware
  • vzdump
  • WHM
  • Wireshark
  • Wordpress Troubleshooting
  • WordPress Tutorial

“See, you not only have to be a good coder to create a system like Linux, you have to be a sneaky bastard too." Linus Torvalds

© 2017 copyright www.linuxtutorial.co.uk // All rights reserved