How to prevent sed -i command overwriting my symlinks on Linux or Unix

The sed -i command on Linux and Unix systems can overwrite symbolic links (symlinks) if not used with caution. To prevent sed -i from overwriting symlinks, you can use the following methods: Use a temporary file: sed ‘s/old-text/new-text/g’ inputfile > tempfile && mv tempfile inputfile This method creates a temporary file, modifies its content, and … Read more

How To Install Linux, Apache, MySQL, PHP (LAMP) Stack on Debian 9 Stretch

Here are the steps to install the LAMP stack on Debian 9 Stretch: Install Apache Web Server: sudo apt-get update sudo apt-get install apache2 Install MySQL Server: sudo apt-get install mysql-server During the installation, you’ll be prompted to set a root password for MySQL. Install PHP: sudo apt-get install php libapache2-mod-php php-mysql Configure Apache to … Read more

How to upgrade from Debian Linux 8 Jessie to Debian 9 Stretch using command line over ssh based session

To upgrade from Debian Linux 8 Jessie to Debian 9 Stretch using command line over an SSH-based session, follow these steps: Log in to your Jessie system using SSH: ssh user@hostname Update the package index: sudo apt-get update Upgrade the system to the latest version of Jessie: sudo apt-get upgrade Make a backup of important … Read more

How to redirect non-www to www HTTP / TLS /SSL traffic on Nginx

Here is a simple Nginx configuration to redirect non-www traffic to www with HTTPS: server { listen 80; server_name example.com; return 301 https://www.example.com$request_uri; } server { listen 443 ssl; server_name example.com; ssl_certificate /path/to/cert.pem; ssl_certificate_key /path/to/cert.key; return 301 https://www.example.com$request_uri; } server { listen 443 ssl; server_name www.example.com; ssl_certificate /path/to/cert.pem; ssl_certificate_key /path/to/cert.key; # Add your website configuration … Read more

How To Patch and Protect Linux Kernel Stack Clash Vulnerability CVE-2017-1000364

The Linux Kernel Stack Clash vulnerability (CVE-2017-1000364) is a security issue that affects the Linux kernel. To protect against this vulnerability, you will need to patch your Linux system by installing the appropriate security updates. The exact steps to patch and protect against this vulnerability will depend on the specific distribution of Linux you are … Read more

How to run two or multiple networks instance of Tinc VPN on same box

Tinc VPN is a virtual private network (VPN) software that allows you to create a secure network between multiple computers. To run two or more network instances of Tinc VPN on the same machine, you will need to perform the following steps for each network: Create separate directories for each network: mkdir /etc/tinc/network1 mkdir /etc/tinc/network2 … Read more