Ubuntu fstab; mount external drive at boot

Procedure for rescuing an Ubuntu Server when the boot file gets messed up due to a misnamed external hard drive.

Backup the current fstab file:

sudo cp /etc/fstab /etc/fstab.old

List the drives:

sudo blkid

Example output:

/dev/sda1: UUID="8F1B-7691" TYPE="vfat" PARTUUID="eea0152e-f8aa-4d1f-8d44-172261edd5a2"
/dev/sda2: UUID="5be250be-a857-11e8-9dd6-a82066361186" TYPE="ext4" PARTUUID="9ba42200-226c-4e67-a667-649658dfbd0b"
/dev/loop0: TYPE="squashfs"
/dev/loop1: TYPE="squashfs"
/dev/loop2: TYPE="squashfs"
/dev/loop3: TYPE="squashfs"
/dev/sdb1: LABEL="media" UUID="746622C40BE949C9" TYPE="ntfs" PTTYPE="dos" PARTUUID="e2bd323d-a7bb-4be8-83bb-4d547fb45e37"

Edit the fstab file:

sudo pico /etc/fstab


GNU nano 2.9.3 /etc/fstab 
UUID=5be250be-a857-11e8-9dd6-a82066361186 / ext4 defaults 0 0
UUID=8F1B-7691 /boot/efi vfat defaults 0 0
/swap.img none swap sw 0 0

#Device #Mountpoint #fs-type #options #dump #fsck
/dev/sdb1 /media/usb ntfs defaults 0 0

Save, reboot.

Force Ubuntu Server to redirect http to https

If you want to redirect your web address from http to https, you will have to configure your server’s virtual host file.

Edit the virtualhost file to update the port 80 portion; replace “test.com” with your domain name:

sudo nano /etc/apache2/sites-available/test.com.conf

Edit the :80 portion (in bold), replacing <ip_or_host> with your domain name:

<VirtualHost *:80>
        ServerName <ip_or_host>
        Redirect "/" "https://<ip_or_host>"

<VirtualHost *:443>
        ServerName <ip_or_host>
        DocumentRoot /var/www/whateverfolder
        SSLEngine on
        SSLCertificateFile      /etc/ssl/certs/apache-selfsigned.crt
        SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key
        <Directory /var/www/whateverfolder/public>
           DirectoryIndex index.php
           AllowOverride All
           Require all granted

Save the .conf file

Modify the default Apache config file:

sudo nano /etc/apache2/sites-available/000-default.conf

Then add the bold portion (starting with “RewriteEngine on”) to the bottom of the file. Replace example.com with your domain name.

<VirtualHost *:80>
     ServerAdmin admin@example.com
     DocumentRoot /var/www/html/example.com/
     ServerName example.com
     ServerAlias www.example.com

     <Directory /var/www/html/example.com/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined

RewriteEngine on
RewriteCond %{SERVER_NAME} =example.com [OR]
RewriteCond %{SERVER_NAME} =www.example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

Enable the .conf files:

sudo a2ensite test.com.conf
sudo a2ensite 000-default.conf

Reboot your apache server:

sudo service apache2 restart

Test your server config in your web browser by typing in: http://www.example.com

Windows 10 and FAT32

Recently, I needed to format a thumb drive to FAT32 in Windows 10 (adding the BleemSync hack to the Sony PlayStation Classic). I could swear the last time I had to do this, the option was there. Today the only options were exFAT and NTFS. Ugh. Windows! Well, I found a nice free tool that allows you to perform this task: Ridgecrop Consultant’s FAT32 utility. Once you visit their site, click on the picture to download the utility.

There’s another option. You can type ‘cmd’ where it says “Type here to search” from the Windows 10 menu. Once the command terminal is open, type (replacing “X” with the drive letter):

Format /FS:FAT32 X:

This method will likely take hours to format the drive.

Internet Security Habits, tips and tricks

Urban Knish discusses some good internet security habits in the age of data collection and man-in-the-middle attacks.

Relevant links:
Firefox Browser, Ghostery Plugin, HTTPS Everywhere, NoScript
ProtonVPN, AstrillVPN, Private Internet Access VPN
Tor Browser for the computer
Tor Browser for IOS
Tor Browser for Android

Phishing victim hacks back

Protonmail, a secure email provider admitted in a tweet to hacking an entity that was impersonating its service in phishing emails. In the United States, this is illegal but Protonmail is located in Switzerland. The company promptly deleted the tweet.

I actually use this service and highly recommend it. Encrypted, secure email located outside the United States is highly preferable to companies like Google and Yahoo that sift through your data, commoditize it and use it to target ads at you. I’m not cool with that or the implications that governments may be spying on me.