Category: Linux

Linux Tips and tricks, either for desktop or internal system.

Linux, Postfix

Relaying emails dependent on either sender or receiver

Introduction: I use a Relay SMTP service for sending my emails but I want to use it only for certain conditions like the sender address or the receiver address. Here is how it’s done: Relay to relay host depending on sender address Add in /etc/postfix/main.cf Create file /etc/postfix/relayhost_map and add this content: Run the following …

Linux

Creating SOCKS Web Proxy using SSH

Introduction: It is known that one can use SSH to create a Tunnel but SSH has more tricks in its sleeves. It can be used to create a SOCKS based Web proxy. The full explanation is really clearly shown in this article: Thanks to the author for that. https://ma.ttias.be/socks-proxy-linux-ssh-bypass-content-filters/ Basics: Prerequisites: A Linux server in …

Linux

Setting up networking on Ubuntu 18.04 for Xen Hypervisor

Introduction: For a long time I have been using ifconfig and /etc/network/interfaces and tools to setup the network of Ubuntu servers. After I have installed a brand new Ubuntu 18.04 I could not use that tool any more, at least without making some system changes. So I finally decided to adapt and see what I …

Apache, Linux, Uncategorized

Configuring Apache for Magento to show different Store Views in from different URLs/Domains.

Introduction: In the following example I try to set environment variables according to the incoming request’s ‘HTTP_HOST’ value. The following example pertains to Magento Webshop software which offers a different Store view for every domain configured to land in the main store. Prerequisites: – Magento is been configured, apart from its default Store View, to …

Linux, MySQL

Repairing MySQL InnoDB databases

Introduction: This post is a copy of the wonderful following post: https://blackbird.si/mysql-corrupted-innodb-tables-recovery-step-by-step-guide/https://blackbird.si/mysql-corrupted-innodb-tables-recovery-step-by-step-guide/ Here are some important exerts from it: MySQL – Corrupted InnoDB tables recovery – Step by step guide Posted in Databases By Alen Krmelj On March 19, 2013, 5-6 minutes InnoDB tables don’t get corrupted easily, but when they do, it usually happens …

Bash, Linux

Listing all email addresses in a file with grep

The following grep command will list all email addresses from a text file and sort them per names without allowing for repetition(-u unique) The following grep command will list all email addresses from a text file and sort them per domain without allowing for repetition(-u unique)

Linux

Adding a new SSD to already Mega LSI RAID controller

I had asked Hetzner for the installation of an extra SSD(‘960 GB SATA SSD Datacenter Edition’) to an already existing RAID 1 array which is where the system is installed in a dedicated Linux server. All I want is to be able to access the drive separately from the already existing RAID drives. I got …

Docker, Linux, Security

Docker Firewall script for DOCKER-USER iptables Chain

Description: Since we can’t protect docker advertised ports on docker using a normal firewall like UFW against attacks from Internet, a script has been written to do just that. Reading the comments in the script does gives an idea of how it works. The only thing to do is to fill in the variables in …

Linux

Installing SNMP in Ubuntu 18.04

Here are the simple steps to install SNMP in Ubuntu 18.04 Reference: https://support.auvik.com/hc/en-us/articles/204221884-How-to-enable-SNMP-on-Linux-based-servers-workstations Next, using your text editor, edit /etc/snmp/snmpd.conf to look like this: # this will make snmpd listen on all interfaces # Or make it listen only to the local private network interface eg. eth0(192.168.100.3) # a read only community ‘local’ and the …

Linux, Linux on MACBook, Uncategorized

Linux Mint 19.3 disabling the menu pop on Mac ‘Left Command’ Press

Introduction: After having installed Linux Mint 19.3 on an old MacBook Pro, I wanted to disable the Menu pop-up function on the ‘Left Command’ key press. Solution: Delete the following entry in the Settings Editor(in the settings menu): xfce4-keyboard-shortcuts –>> /commands/custom/Super_L | xfce4-popup-wiskermenu Calveat: First I could not delete the command. Then I simply deleted …

Linux, Linux on MACBook

Linux Mint 19.3 on MacBook Pro: Set F1-F12 as default function without pressing ‘Fn’

Inroduction: After having installed Linux Mint 19.3 on an old MacBook Pro I wanted to be able to use the function keys without having to press on the ‘Fn’ key Here is the answer: Reference: https://www.reddit.com/r/linuxmint/comments/4cecsz/set_f1f12_as_default_function_without_pressing_fn/ Solution: You can run a simple command to change the behavior. Therefore to get what I wanted the command …

Linux, Windows

Using Postfix to deliver mail using SMTP Authentication

Reference: https://www.linode.com/docs/email/postfix/postfix-smtp-debian7/ Open or create the /etc/postfix/sasl_passwd file, using your favorite text editor: Add your destination (SMTP Host), username, and password in the following format: If you want to specify a non-default TCP Port (such as 587), then use the following format: Create the hash db file for Postfix by running the postmap command: If …

Linux

APT ‘Not Found [IP: 2001:67c:1562::15’

Reference: https://ubuntuforums.org/showthread.php?t=2282646 If you encounter such errors of fetching packages with apt/apt-get: E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/u/ubuntu-release-upgrader/python3-distupgrade_18.04.36_all.deb 404 Not Found [IP: 91.189.88.142 80] E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/u/ubuntu-release-upgrader/ubuntu-release-upgrader-core_18.04.36_all.deb 404 Not Found [IP: 91.189.88.142 80] E: Unable to fetch some archives, maybe run apt-get update or try with –fix-missing? Then do the following to give precedence …

Linux, Security

Using UFW as IP Blacklist

Introduction: There are instances where a service provider is taking care of the Firewall which is working between Internet and the rented server. In this case only certain standard ports will be made available to access the rented server. But what if you need a general use ‘blacklist’ firewall that will filter out abusive traffic …

Linux, Systemd

GRUB on EUFI capable System

Introduction:New PCs are often equipped of the UEFI(Universal EFI) capable booting. Some SSD drives will even not boot in Linux the Legacy MBR mode. So in order to make the PC boot properly we need to:– Create an EFI Partition– Install GRUB(Boot loader) on it Create the EFI Partition:Create an EFI capable Boot partition of …

Email, Linux, Mailman

Minimize the Digests shown Headers in Mailman 2.1.xx

Problem: Digests in Mailman are composed of a lots of unneeded headers which clutter the messages. Solution: Edit the Mailman configuration file manually as follows: WARNING !!!: These headers are part of a the ‘RFC 1153’ which if changed can have unpredictable or unwanted effects. So here I kept the headers: Date:, From:, Subject:, Keywords(if …

Email, Linux, Postfix

Configuring Domain Relaying with ISPConfig 3.1.xx

Intention: Redirect (reroute) specific email addresses via, for example, an SMTP service: Steps: – Enter the destination domain in the Advanced Routing Table (Email ==> Email Accounts/Email Routing) – Enter the same destination domain in the (Email ==> Global Filters / Relay Recipients) as @domain Example: eg. rerouting all emails of destination domain mydomain.com via …

Email, Linux, Postfix

No Type list in ISPConfig 3.1.11

Problem: The brand new version of ISPConfig 3.1.11 when I add or modify an email transport, no value is displayed anymore on “type”. Solution: Ref: https://git.ispconfig.org/ispconfig/ispconfig3/issues/4924 Edit /usr/local/ispconfig/interface/web/mail/mail_transport_edit.php Change this line: $app->tpl->setVar($rec, null, true); to this: $app->tpl->setVar($rec); and should work again.

Linux, MySQL, Security

Resetting MySQL/MariaDB root password in Ubuntu 16.04/18.04

Introduction: In case you have forgotten the ‘root’ password in MySQL/MariaDB(10.0.x) you can reset the password as follows: Ref: https://kofler.info/root-login-problem-mit-mariadb/ STEPS: Stop the currently running MySQL/MariaDB service mysql stop Start MySQL/MariaDB in non-protected mode: mysqld_safe –skip-grant-tables –skip-networking & Login as root in MySQL/MariaDB mysql -u root Set the new root password: For MySQL Previous to …