Setting Up Ubuntu 18.04 as Rails ServerOctober 04, 2018 |
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.
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.
Logging into mysql -u root with non root user on Mysql 5.7November 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
.
Use sudo to login:
sudo mysql -u root
Change login plugin:
How to safely remove Byte Order Marks (BOM) from files created on windowsOctober 15, 2017 |
If you read enough files created on a windows box you'll eventually run into this. ""\xEF\xBB\xBFyour expected string"
instead of "your expected string"
. I recently ran into again while parsing some csv files exported in windows. In order to parse the string you'll need to remove what is called a Byte Order Mark.
Just search for "\xEF\xBB\xBF"
and remove it.
Setting up MacOS Sierra for Rails DevelopmentDecember 15, 2016 |
One of the only differences I've noticed is installing mysql is slightly different.
Install xcode.
xcode-select --install
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew doctor
brew update
brew install rbenv ruby-build openssl