Isaac Sloan - Web Developer, Photographer, Musician and Citizen of Earth
Banner700

Setting Up Ubuntu 18.04 as Rails Server

October 04, 2018

Step 1: Install Ubuntu

Step 2: Add a deploy user and optionally a user for yourself.

Assuming you're logged in as root add these users and login as "not root."

adduser deploy
adduser [yourname] #optionally
vim /etc/group
# add your users to the sudo group like so: 
  sudo:x:27:isaac,deploy
vim /etc/ssh/sshd_config
# add to file or if they exist set the flags to no.
Setting Up Ubuntu 18.04 as Rails Server

Binding to port 80 or 443 with a non root user.

November 30, 2017

Apparently it's impossible to bind to a port under 2000 with a non privilaged user. Not sure how I got this far into my career without knowing that.

Anyway the solution is to run this as a root user to give the binary permission.

sudo setcap CAP_NET_BIND_SERVICE=+eip /path/to/binary

This can be problematic as every-time the binary changes you have to do it again.

Binding to port 80 or 443 with a non root user.

Logging into mysql -u root with non root user on Mysql 5.7

November 30, 2017

When you upgrade from Mysql 5.6 to 5.7 you will no longer be able to log into mysql's root user without root access.

This is annoying if you're using it for development as most frameworks assume the development database can be connected to via root user with no password.

This solution is to change the login plugin back to native_password.

  1. Use sudo to login:

    sudo mysql -u root

  2. Change login plugin:

Logging into mysql -u root with non root user on Mysql 5.7

Lets Encrypt Setup and Auto Renew (NGINX)

July 20, 2016

Installation and Setup

sudo su  - root # NOTE: This has to be run as root. Be very careful!
cd /usr/sbin
wget https://dl.eff.org/certbot-auto
chmod a+x certbot-auto
./certbot-auto

Nginx Configuration

Add the following to your nginx server configuration block vim sites-enabled/yourdomain.com

  location ^~ /.well-known/ {
    root /usr/share/nginx/html;
  }
Lets Encrypt Setup and Auto Renew (NGINX)

Useful SSH Server Conf Tricks

April 24, 2016

Turning password login off

Edit /etc/ssh/sshd_conf
ChallengeResponseAuthentication no
PasswordAuthentication no
UsePAM no
Restart ssh

sudo service ssh restart

Turn on password login

ChallengeResponseAuthentication yes
PasswordAuthentication yes
UsePAM yes
Restart ssh

Copy and pasting from remote vim

1. Edit /etc/ssh/ssh_config
Useful SSH Server Conf Tricks