fatal: open /etc/postfix/main.cf: Permission denied

On a CentOS server, when sending mail from PHP scripts, mail failed to work. On checking postfix log file (/var/log/maillog), i see following error.

To fix this, disable selinux

To permanantly disable SELinux, run

[…]

Read More…

Protecting files with noclobber

To protect files on Linux by accidently overwritten by > operator, you can use

Now if you try to overwrite a file with >, you will get error

If you really need to overwrite, use >! operator.

Example

Instead of running the command “set -o noclobber” everytime, you can add it […]

Read More…

Email Alert When User Login Using SSH

On web servers, you may need to get email alert when someone login to your server using SSH. To do this edit file

Add

In above, replace [email protected] with your actual email address. You need a mail server installed on your server for this to work. If you want to log to a […]

Read More…

KVM VNC Allow Remote Access

By default VNC Console on a KVM virtual Machine only listens to localhost. So you need to do SSH tunnel to access VNC console. To make VNC available on all interfaces on Host machine, you need to edit file

You need to uncomment the line vnc_listen = “0.0.0.0”.

Once this is done, you […]

Read More…

Install Linux KVM on CentOS 8

To install Linux KVM hypervisor on CentOS 8, run

Install libvirtd

Enable libvirtd to start on boot

Start libvirtd

To see status, run

Install virt-install

Now you have Linux KVM installed. You can use virt-install or Virt Manager to create virtual machine. See Linux KVM Virtualization […]

Read More…

Joining files with Cat on Linux

I have a movie cut with hjspit.

To join them on Linux, run

[…]

Read More…

apt force IPv4

One of my internet provider only provide IPv4 connection. When i run apt install command, it failed with error as it try to connect using IPv6.

To force apt to use IPv4 only, edit

Add

If you want to force IPv6, add

[…]

Read More…