Category Archives: Operating Systems

How to add multiple IPs to an Amazon EC2 virtual machine


You have a Server 2008 R2 machine on Amazon EC2.

You want to secure multiple domains using different  SSL/TLS certificates.

Server 2008 R2 does not support Server Name Indication (SNI). Therefore you need to add multiple IPs to the machine to use different SSL/TLS certificates.

  1. Create an EC2 virtual machine.
  2. Create an EC2 network interface.
  3. Assign the network interface to the machine using the Attach feature in the Network Interfaces tab.
  4. Create multiple private IPs for the network interface using Manage IP Addresses feature.
  5. Allocate multiple elastic IPs in the Elastic IPs tab.
  6. Assign an elastic IP to a private IP of the network interface using the Associate Address feature in the Elastic IPs tab.
  7. Login Windows.
  8. View the network configuration using below command.
ipconfig /all

9. Manually configure the network adapter (Local Area Connection Network) using the information in the 8th step.

10. Add the private IPs in the 4th step to the machine in the Advanced TCP/IP Settings screen.

11. Restart the machine.

If you get any issue then try limit the number of private IPs of a network interface to 4 (including the default private IP)

How to move a WordPress instance from one server to another Linux server


You want to move a WordPress instance from one server to another to consolidate your websites to reduce cost.


Install and use below Duplicator plugin to achieve your goal.

User guide:

If everything goes well for you then congratulation!

Otherwise, please review below possible problems and corresponding solutions.

Problem 1:

You don’t have a website on the new server.

Solution 1:

1. Create a new virtual host in the /etc/httpd/conf/httpd.conf

<VirtualHost *:80>
DocumentRoot "/var/www/"

2. Set 775 permission for /var/www/

3. Restart httpd service

sudo systemctl restart httpd

Problem 2:

You are using Amazon Linux 2 server.

You are logged in as ec2-user.

You use WinSCP to upload files and edit configuration files.

You cannot modify /etc/httpd/conf/httpd.conf and /etc/php.ini.

Solution 2:

1 View permission settings for the file

ls -ld /etc/httpd/conf/httpd.conf

The result indicates that the file owner is root user and root group, not ec2-user.

2. View groups of a user

groups ec2-user

The result indicates that the ec2-user does not belong to root group.

3. Add a user to root group

sudo usermod -a -G root ec2-user

4. Grant Read-Write permission against a file to root group

sudo chmod g+rwx /etc/httpd/conf/httpd.conf
sudo chmod g+rwx /etc/php.ini

5. Logout and login to the server again.

Problem 3:

You are using Amazon Linux 2 server. The ZipArchive feature is missing.

Solution 3:

1. Execute below commands:

sudo amazon-linux-extras install php7.2
sudo yum install php-pear php-devel gcc libzip-devel zlib-devel
sudo pecl install zip-1.13.5 # we must specify a slightly older version due due to compatibility

2. Add “” to /etc/php.ini

3. Restart the server

sudo reboot

Problem 4:

You don’t have a WordPress database on the new Linux server.

Solution 4:

Execute below MySQL commands:

CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
CREATE DATABASE `wp_database`;
GRANT ALL PRIVILEGES ON `wp_database`.* TO "username"@"localhost";

Problem 5:

An database error occurs while restoring a website.

Solution 5:

1. Execute below commands to remove the website:

sudo chown -R ec2-user:apache /var/www/
sudo chmod 2775 /var/www/ && find /var/www/ -type d -exec sudo chmod 2775 {} \;
find /var/www/ -type f -exec sudo chmod 0664 {} \;
rm -r /var/www/

2. Upload the Duplicator files again, and restore the website again.

Problem 6:

No write access against /var/www/ is available for Duplicator.

Solution 6:

1. Execute below commands:

sudo chown -R ec2-user:apache /var/www/
sudo chmod 2775 /var/www/ && find /var/www/ -type d -exec sudo chmod 2775 {} \;
find /var/www/ -type f -exec sudo chmod 0664 {} \;

2. Run again.

How to connect and upload files to a remote machine using OpenVPN and SSH on macOS


You have a server inside a network. You are granted OpenVPN and SSH access to the server. You have a MacBook. You want to upload files to the server. You want to execute a process on the server (e.g. training a machine learning model).


  • Request a certificate and an Open VPN configuration file (an .ovpn file) from your network administrator.
  • Install Tunnelblick
  • Drag the Open VPN configuration file to the Tunnelblick Configurations tab.
  • Click the Connect button.
  • On macOS, open Terminal and execute below command
ssh root@ -p 7081

where is the machine IP and 7081 is the SSH port

How to completely uninstall Python on Mac OS?


You have an issue with a Python version (e.g. the 3.7 version) and want to install another version (e.g. the 3.6 version). In order to install a fresh version you need to uninstall the current version first.


Assume that the current version is 3.7. Replace 3.7 with another version that you installed.

Follow these 3 steps below.

1. Remove the third-party Python 3.7 framework

sudo rm -rf /Library/Frameworks/Python.framework/Versions/3.7

2. Remove the Python 3.7 applications directory

sudo rm -rf "/Applications/Python 3.7"

3. Remove the symbolic links, in /usr/local/bin, that point to this Python version. Ensure that the links exit using below command.

ls -l /usr/local/bin | grep '../Library/Frameworks/Python.framework/Versions/3.7'

and then run the following command to remove all the links:

cd /usr/local/bin/
ls -l /usr/local/bin | grep '../Library/Frameworks/Python.framework/Versions/3.7' | awk '{print $9}' | tr -d @ | xargs rm


Installing a new version:

  1. Download a version from, double click the file and follow the instructions.
  2. Verify installation: python3 –version
  3. Install Homebrew from
  4. Install virtualenv
  5. pip3 install virtualenv
    pip3 install virtualenvwrapper

5.  Create and activate a virtual environment

cd /Users/admin/Downloads/training_model/model 
python3 -m virtualenv /Users/admin/Downloads/training_model/model
source bin/activate

How to Fix the Dell Laptop “Hard Drive Not Installed” issue


Suddenly, when turning your Dell laptop on you get the error message “Hard drive Not installed” and cannot boot into Windows.

  1. Power your laptop and quickly press F2 key to enter BIOS.
  2. Expand System Configuration node.
  3. Click SATA Operation.
  4. Select AHCI option.
  5. Click Apply button.
  6. Click Exit button.
  7. If the problem still persists then restore BIOS settings to Default BIOS settings and try the procedure again.


Setting File Permissions for WordPress on IIS


  • You have a WordPress instance in Windows with IIS.
  • You upload a file. Its thumbnail is not shown in Media Library.
  • You change the file permission. Its thumbnail now is shown correctly in Media Library.
  • You upload another file and have to change the file permission manually again.
  • How can we make WordPress automatically set the correct permission for new uploaded files?


  1. Ensure that the the Identity of Application pool that the website is running under is ApplicationPoolIdentity.
  2. Execute below commands as Administrator
icacls "C:\inetpub\wwwroot\" /grant "IUSR":(OI)(CI)F /T
icacls "C:\inetpub\wwwroot\" /grant "IIS_IUSRS":(OI)(CI)F /T

3. Open IIS Manager, click on your website, click Authentication, click Anonymous Authentication (which should be the only one enabled), click Edit, select Application pool identity if it is not selected, click OK.

How to change a WordPress website’s domain name?
  • Open the wp-config.php file.
  • Add two lines to the file, right before /* That’s all, stop editing! Happy blogging. */:
  • Bulk edit the posts content if needed.

How to Count The Number of Source Lines of Code using Windows Command


  • You have a source code folder and want to know the number of source lines of code.


  1. Right click Start icon, click on Command Prompt (Admin) or Windows Powershell (Admin)
  2. Assume that the source code folder location is C:\Users\admin\Downloads\test, type below commands and press Enter
cd C:\Users\admin\Downloads\test

3. Assume that the source code file extension is .py, type below commands and press Enter

type *.py | Measure-Object -line


Windows Commands for Website Administrators


  • You have a web application the backup of which needs to be  created daily.
  • You have a web application the content of which needs to be replicated daily.
  • You have data folder the content of which needs to be augmented daily.


  • Copying from one folder contents to another folder:
robocopy E:\inetpub\wwwroot\ E:\inetpub\wwwroot\ /e

/e Copies subdirectories. This option includes empty directories.
  • Moving from one folder contents to another folder:
robocopy E:\inetpub\wwwroot\ E:\inetpub\wwwroot\ /move /e

/move Moves files and directories, and deletes them from the source after they are copied.
  • Granting Full permission to a user or group
icacls "E:\inetpub\wwwroot\\App_Data" /grant "IUSR":(OI)(CI)F /T

icacls "E:\inetpub\wwwroot\\App_Data" /grant "IIS_IUSRS":(OI)(CI)F /T

CI Container Inherit - This flag indicates that subordinate containers will inherit this ACE (access control entry).

OI Object Inherit - This flag indicates that subordinate files will inherit the ACE.

OI and CI only apply to new files and sub-folders).

F Full Control

/T Apply recursively to existing files and sub-folders.
  • Deleting and creating a folder
rmdir "E:\inetpub\wwwroot\\Temp\" /S /Q 
mkdir "E:\inetpub\wwwroot\\Temp\
  • Recurcively deleting all specific files in a folder and its sub-folders
cd C:\inetpub\wwwroot
del /s *.log
/s delete all the files in the sub-folders.

del /s /f /q *.*
/f force deletion of read-only files.
/q do not ask to confirm when deleting via wildcard.
  • Removing a drive letter from a volume
mountvol F: /D
/D remove the drive letter from the selected volume.
  • Copy (mirror) entire data from one drive to another, including file and folder permissions.
robocopy E:\ G:\ /MIR /COPYALL /ZB /W:1 /R:2 /XO 


robocopy E:\ G:\ /TEE /LOG+:F:\robolog.txt /MIR /COPYALL /ZB /W:1 /R:2 /XO

E:\ - Source folder. This can be a UNC path.
G:\ - Destination folder. This can be a UNC path.

/TEE - Display the output of the command in the console window and write it to a log file.

/LOG+:F:\robolog.txt - Write the logs to F:\robolog.txt. The + sign means appending the content to the log file.

/MIR - Copy all files and subfolders, remove files and folders from the destination if they no longer exist on the source.

/COPYALL - Copy all of the NTFS permissions and attributes (security permissions, timestamps, owner info, etc.)

/ZB - Use restartable mode when copying files. If a file is in use, retry after a set amount of time (see /W:1 and /R:2). If access is denied then try to copy in backup mode.

/W:1 - Wait for 1 second between retries when copying files.

/R:2 - The number of retries on failed copies.

/XO - eXclude Older files/folders if the destination file or folder exists and has the same date.
If destination file exists and is the same date or newer than the source - don't bother to overwrite it.
  • Augment data (make an incremental backup) from one drive to another, including file and folder permissions.
robocopy E:\ G:\ /E /COPYALL /ZB /W:1 /R:2 /XO /XX


robocopy E:\ G:\ /TEE /LOG+:F:\robolog2.txt /E /COPYALL /ZB /W:1 /R:2 /XO /XX

/E - Copy Subfolders, including Empty Subfolders.
/XX - eXclude "eXtra" files and dirs (present in destination but not source). This will prevent any deletions from the destination.

How to transfer Photos from iPhone to PC with highest quality

Problem: Images copied directly from iPhone to a PC usually have lower quality in comparison with the original quality due to format conversion.

You want to preserve the quality as high as possible.


  1. Connect iPhone to a MacBook.
  2. Open Photos app.
  3. Click on iPhone’s name under Devices section on the left.
  4. Select photos on the right.
  5. Select Import to = Library or New Album.
  6. Click on Import N Selected button, where N is the number of selected photos, to Import photos from iPhone to iPhotos.
    • The imported photos will be copied from iPhone to iPhotos.
    • You have to manually delete the photos directly from iPhone if you want to permanently remove them from iPhone.
  7. Click on an album name on the left menu in iPhotos.
  8. Select the imported images in the album.
  9. Click File > Export > Export N Photos… (N is a number) to export photos from iPhotos to a folder on MacBook.
    • Select Arrow icon at the end of Photo Kind
    • Select PNG
    • Select Color Profile = Original
    • Select Size = Full Size
    • Select Movie Quality = 4K
  10. Click the Export button.
  11. Enter a folder name.
  12. Click the Export button. Wait for the exporting process to be completed by reviewing the circle icon in the toolbar.
  13. Share the folder in a LAN.
  14. Copy the folder to a PC.


Anti-Virus vs. Anti-Malware

What is the difference between anti-virus software and an anti-malware software?

A virus is a piece of code that is capable of copying itself in order to do damage to your computer, including corrupting your system or destroying data.

Malware, on the other hand, is an umbrella term that stands for a variety of malicious software doing damage to your computer or stealing your information, including Trojans, spyware, worms, adware, ransomware, and yes, viruses.

So the logic follows: all viruses are malware. Not all malware are viruses.

Anti-virus software generally scans for infectious malware which includes viruses, worms, Trojans, rootkis and bots.

Anti-malware software generally tends to focus more on adware, spyware, unwanted toolbars, browser hijackers, potentially unwanted programs and potentially unsafe applications.

Therefore, you need both an anti-virus and an anti-malware solution for maximum protection.

Built-in Windows Defender provides both anti-virus and anti-malware protection, and IMO, is enough for non-tech-savvy users.

A comprehensive FREE anti-virus software is AVG.

A comprehensive FREE anti-malware software is Malwarebytes

An ads blocker for Edge browser is uBlock Origin

An ads blocker for Firefox browser is Adblock Plus