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. Aug 11 01:41:53 forums postfix/sendmail[44463]: fatal: open /etc/postfix/main.cf: Permission denied To fix this, disable selinux setenforce 0 To permanantly disable SELinux, run sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/’ /etc/selinux/config

Protecting files with noclobber

To protect files on Linux by accidently overwritten by > operator, you can use set -o noclobber Now if you try to overwrite a file with >, you will get error root@ok:~# echo “Hello” > 1.txt -bash: 1.txt: cannot overwrite existing file root@ok:~# If you really need to overwrite, use >! operator. echo “Hello” >! … Read more

Email Alert When User Login Using SSH

On web servers, you may need to get email alert when someone logs in to your server using SSH. To do this edit file Add In above, replace you@your-domain.com 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 file, … 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 vi /etc/libvirt/qemu.conf You need to uncomment the line vnc_listen = “0.0.0.0”. # VNC is configured to … 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

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

CentOS 7 resolv.conf make changes permanent

On rebooting the CentOS 7 server, changes made to resolv.conf is lost. This is because one of the network interface is configured to use DNS server. To fix, edit Remove the line Now NetworkManager will not modify /etc/resolv.conf file on boot. Or you can set valid DNS servers in network config file like If your … Read more