13 Jun 2020

How to install KVM for Virtualization in LinuxMint

This article shows you, how to install KVM in Linux Mint for Virtualization


1. Install qemu-kvm and libvirt
2. Add user to libvirt group
3. Remote access via SSH
4. Add a pool for ISO file


1. Install qemu-kvm and libvirt

Use the following command to install qemu-kvm package and some packages for virtual machine operation.

$ sudo apt install -y -o 'apt::install-recommends=true' \
  qemu-kvm libvirt0 libvirt-bin virt-manager libguestfs-tools

2. Add user to libvirt group

This command for the user in libvirt group can run virt-manager and virsh without sudo.

$ sudo gpasswd libvirt -a <username>
$ sudo reboot

3. Remote access via SSH

Following command for virt-manager and virsh provdes remote access via SSH. If you want to use SSH public key authentication, you can omit inputting password.

Create SSH keys on client, which use remote access via SSH.

$ ssh-keygen -t rsa -f ~/.ssh/id_rsa -N ""
Generating public/private rsa key pair.
Your identification has been saved in /home/idatahost/.ssh/id_rsa.
Your public key has been saved in /home/idatahost/.ssh/id_rsa.pub.
$ cat ~/.ssh/id_rsa.pub
ssh-rsa AAAAB... [email protected]

Now add SSH public key entry to ~/.ssh/authorized_keys on server which is installed KVM.

$ cat ~/.ssh/authorized_keys
ssh-rsa AAAAB... [email protected]

Now specify server URI with -c option on client.

$ virsh -c qemu+ssh://[email protected]/system

Setting server URI to VIRSH_DEFAULT_CONNECT_URI is equal with specifying server URI with -c option. Write VIRSH_DEFAULT_CONNECT_URI settings in your .bashrc if you need.

$ export VIRSH_DEFAULT_CONNECT_URI=qemu+ssh://[email protected]/system
$ virsh

4. Add a pool for ISO file

Create ISO directory and define as pool.

$ sudo mkdir /var/lib/libvirt/isos
$ virsh pool-define-as isos dir - - - - /var/lib/libvirt/isos
$ virsh pool-autostart isos
$ virsh pool-start isos
11 Jun 2020

406 Error [Not Acceptable An appropriate..]

Not Acceptable
An appropriate representation of the requested resource could not be found on this server.
406 Error in DirectAdmin

That would be because false-positive ModSecurity rules are being hit. You may either try changing ModSecurity ruleset or disabling ModSecurity altogether, for example, to change ModSecurity ruleset from owasp to comodo, execute the following commands:

cd /usr/local/directadmin/custombuild
./build set modsecurity yes
./build set modsecurity_ruleset comodo
./build modsecurity

Additionally you might need to run
For Apache

./build apache
./build rewrite_confs

For Nginx

./build nginx
./build rewrite_confs

How to Disabled ModSecurity altogether

cd /usr/local/directadmin/custombuild
./build set modsecurity no
./build set modsecurity_ruleset comodo
./build modsecurity

Additionally you might need to run:
For Apache:

./build apache
./build rewrite_confs

For Nginx

./build nginx
./build rewrite_confs
09 Jun 2020

How to install ClamAV in DirectAdmin Linux Server

*** Note *** Technical support for ClamAV is very limited. Use at your own risk.

To install ClamAV:

1) Install the binaries:

cd /usr/local/directadmin/custombuild
./build update
./build set clamav yes
./build clamav

If you’re running CustomBuild 2.0 exim.conf changes are not required, as it uses .include_if_exist options in the exim.conf.  Skip to Step 4.

2) Edit your /etc/exim.conf, and add the following before “primary_hostname  =”:

av_scanner = clamd: 3310

Skip this step (#2) if you are running CustomBuild 2.0, as it adds this for you with /etc/exim.clamav.load.conf.

3) Restart Exim

<pre>systemctl restart exim</pre>

09 Jun 2020

What is ModSecurity and How to Enable ModSecurity in DirectAdmin


With over 70% of all attacks now carried out over the web application level, organizations need every help they can get in making their systems secure. Besides ModSecurity antivirus can help to reduce malware. For linux server ClamAV/Maldet antivirus enough good. You can follow the post

“How to install ClamAV antivirus on DirectAdmin Linux server”

“How to install ClamAV antivirus on DirectAdmin Linux server and scan public_html folder”

Web application firewalls are deployed to establish an external security layer that increases the protection level, detects and prevents attacks before they reach web-based software programs.

ModSecurity is an open-source web-based firewall application (or WAF) supported by different web servers: Apache, Nginx and IIS.


The module is configured to protect web applications from various attacks. ModSecurity supports flexible rule engine to perform both simple and complex operations. It comes with a Core Rule Set (CRS) which has various rules for:

  • cross website scripting
  • bad user agents
  • SQL injection
  • trojans
  • session hijacking
  • other exploits

To enable ModSecurity:

cd /usr/local/directadmin/custombuild
./build set modsecurity yes
./build set modsecurity_ruleset owasp
./build modsecurity

Additionally you might need to run

For Apache:

./build apache
./build rewrite_confs

For nginx:

./build nginx
./build rewrite_confs


08 Jun 2020

How to Fix “failed to mount /etc/fstab” Error in Linux

In this article, i will explain how to solve “failed to mount /etc/fstab” boot error in Linux. The file in question contains descriptive information concerning the filesystems the system can mount automatically at boot time.

This information is static and is read by other programs on the system such as mount, umount, dump and fsck. It has six important filesystem mount specification fields: the first field describes the block special device or remote filesystem to be mounted, the second field defines the mount point for the filesystem and the third specifies the filesystem type.

The fourth field defines the mount options associated with the filesystem, and the fifth field is read by dump tool. The last field is used by fsck tool to establish the order of filesystem-checks.

After editing the /etc/fstab to create an automount and rebooting my system; it booted into emergency mode showing the error message below.

Linux Emergency Mode

I logged in as root from the interface above, and typed the following command to look through the systemd journal; then I saw the errors shown in the screen shot (indicated using red).

As you can see, the main error (failure of etc-fstab.mount unit) lead to several other errors (systemd unit dependency issues) such as failure of local-fs.target, rhel-autorelabel-mark.service etc.

# journalctl -xb


Boot Error Messages

Causes of “failed to mount /etc/fstab” Error in Linux

The error above may result from any of the issues below, in the /etc/fstab file:

  • missing /etc/fstab file
  • wrong specification of filesystem mount options,
  • failing mount points or
  • unrecognized characters in the file.

To solve it, you can use the original file if you created a backup, otherwise comment out any changes you made using the “#” character (and also ensure that all the uncommented lines are filesystem mount lines).

So I opened the /etc/fstab using vi/vim/nano text editor to check for any errors.

# vi /etc/fstab

Linux /etc/fstab File

I realized I had typed an “r” letter at the beginning of the file as shown in the screen shot above – this was recognized by the system as a special device which did not actually exist in the filesystem, thus resulting to the sequential errors shown above.

This took me several hours before noticing and fixing it. So I had to remove the letter, commented out the first line in the file, closed and saved it. After running a reboot, the system booted well again.

How to Avoid Such Issues in the Future

To avoid encountering such issues on your system, take note of the following:

Always create a backup of your config files before editing them. In case of any errors in your configs, you can revert to the default/working file.

For instance:

# cp /etc/fstab /etc/fstab.orig

Secondly, check config files for any errors before saving them, certain applications offer utilities to check syntax of config files before running the application. Use these utilities where possible.

However, if you happen to get any system errors messages:

First look through the systemd journal using the journalctl utility to determine what exactly caused them:

# journal -xb

If you can’t resolve the errors in one way or the other, run to any of the millions of Linux forums on the web and post the issue there.

08 Jun 2020

How to Boot into Single User Mode in CentOS/RHEL 7

Single User Mode (sometimes known as Maintenance Mode) is a mode in Unix-like operating systems such as Linux operate, where a handful of services are started at system boot for basic functionality to enable a single superuser perform certain critical tasks.

It is runlevel 1 under system SysV init, and runlevel1.target or rescue.target in systemd. Importantly, the services, if any, started at this runlevel/target varies by distribution. It’s generally useful for maintenance or emergency repairs (since it doesn’t offer any network services at all), when a computer is not capable of normal operations.

Some of the low-level repairs include running such as fsck of damaged disk partitions, reset root password if you have lost it, fix “failed to mount /etc/fstab” error – just to mention the most critical of them. And also when the system fails to boot normally.

In this tutorial, we will describe how to boot into single user mode on CentOS 7. Note that practically this will help you enter the emergency mode and access an emergency shell.

How to Boot into Single User Mode

1. First restart your CentOS 7 machine, once boot process starts, wait for the GRUB boot menu to appear as shown in the screen shot below.

Centos7 password reset image


2. Next, select your Kernel version from the grub menu item and press e key to edit the first boot option. Now use the Down arrow key to find the kernel line (starts with “linux16“), then change the argument ro to rw init=/sysroot/bin/sh as shown in the screen shot below.

3. Once you have finished the task in the previous step, press Ctrl-X or F10 to boot into single user mode (access an emergency shell).

4. Now mount root (/) filesystem using the following command.

chroot /sysroot

At this point, you can perform all the necessary low-level system maintenance tasks. Once you are done, reboot the system using this command.

reboot -f

Thank you. Enjoy 🙂

04 Jun 2020

How To Reset Root Password On CentOS 7

CentOS7 is root password changing is totally different from CentOS 6. Now I going to show you how to reset root password in CentOS 7. This way also working for Citrix Xenserver Virtual Machine, KVM and other’s Virtual Machine platform. Even you can reset CentOS 7 password, if your server going to Emergency Maintenance mode.

Step 1: In the boot grub menu select option to edit

Press e

Centos7 password reset image

Step 2: Go to the line of Linux 16 and find out ro

Step 3: Now change ro with rw init=/sysroot/bin/sh

Step 4: Now press Control+x to start on single user mode

Step 5: Now access the system with this command

chroot /sysroot

Step 6: Reset the password.

passwd root

Step 7: Update selinux information

touch /.autorelabel

Step 8: Exit chroot


Step 9: Reboot your system


That’s it 🙂 Enjoy! 🙂

iDATA HOST. All rights reserved