Development User - HVboom/HowTo-DigitalOcean GitHub Wiki
Man page useradd(8)
# -G = <list of secondary groups> (optional): group _sudo_ allows _sudo_ commands
# -m = create a home directory
# -s = <login shell>: must be defined in _/etc/shells_
sudo useradd -G develop,www-data,rvm -m -s /bin/bash <user name>
sudo passwd <user name>
sudo usermod -a -G <group name> <user name>
Man page pw(8)
# -n = <user name>
# -g = <primary group> (optional) - default: creating a new group with the same name as the user
# -G = <list of secondary groups> (optional): group _wheel_ allows _sudo_ commands
# -m = create a home directory
# -d = <home directory> (optional) - default: /home/<user name>
# -c = <comment> (optional)
# -s = <login shell>: must be defined in _/etc/shells_
# -k = <directory of skeleton dot files>: use _/var/empty_ to not create any dot files
# -h - = <disable password based login>
# -w yes = <password is the same as the user name>
# -p 0m = expire password on first login
sudo pw useradd -n "<user name>" -G staff,www -m -k /var/empty -c "Rails developer" -s /usr/local/bin/bash -w yes -p +0m
See ssh-keygen for further details.
# login with `su - <user name>`
# -t ed25519 = newest standard encryption algorithm
# -a 150 = how many times the generated key is mangled around - good values are between 80 and 200 turnaround
# -b 521 = number of bits for the key - allowed values are 256, 384 or 521 bits
# -C = comment for easier key recognition
# the usage of a passphrase is recommended
ssh-keygen -t ed25519 -a 150 -b 521 -C"<user name>@HVboom.biz"
- Add public keys of all your remote machines to the file $HOME/.ssh/authorized_keys
- permissions of that file has to be
600
- permissions of that file has to be
Setup Rails development environment
Install RVM
Note
Not needed on Ubuntu due to centralised RVM setup
See RVM Security for further details.
# Download the gpg keys
gpg2 --keyserver keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
/usr/local/share/bin/setup_rvm
Add user to GitHub
- Login to your GitHub account
- Add the public SSH key
cat .ssh/id_ed25519.pub
- Ensure, that your GitHub key is added to the SSH agent
ssh-add .ssh/id_ed25519
- Test the connection with
ssh -T [email protected]
- This message should be printed:
Hi <GitHub user>! You've successfully authenticated, but GitHub does not provide shell access.
- If not please see GitHub Troubleshooting SSH
- This message should be printed:
git config --global user.name "<full user name>"
git config --global user.email "<user email>"
git config --global push.followTags true
# create a directory and make sure Passenger could access it
mkdir -p $HOME/RubyOnRails && chmod o+rx $HOME && chgrp www-data $HOME/RubyOnRails && chmod g+s $HOME/RubyOnRails
# create a directory and make sure Passenger could access it
mkdir -p $HOME/RubyOnRails && chmod o+rx $HOME && chgrp www $HOME/RubyOnRails
Install Fuse for macOS
- Download and install the latest package - I installed 4.0.1
Install SSHFS
- Download and install the latest package - I installed 2.5.0 using the link provided on Fuse for macOS
- Current release of SSHFS is 3.7.1, but I don't want to compile it on my own for the time being
- To use such an "old" version a symbolic link with the correct access rights has to be created
cd /usr/local/lib sudo ln -s libosxfuse.2.dylib libosxfuse_i64.2.dylib sudo chmod -h 755 libosxfuse_i64.2.dylib
-
Create a shell script based on following template. Just substitute
<Remote Home>
,<Remote User>
and<Local User>
,<Local Directory>
accordingly.- Details regarding the SSHFS options can be found in the OSX Fuse Wiki
#!/usr/bin/env bash # sshfs -o reconnect,auto_cache,auto_xattr,noappledouble,noapplexattr,volname=RubyOnRails <Remote User>@hvboom.org:RubyOnRails /Users/<Local User>/<Local Directory>/RubyOnRails sshfs -o reconnect,auto_cache,auto_xattr,noappledouble,noapplexattr,volname=RubyOnRails [email protected]:RubyOnRails /Users/hvboom/HVboomRemote/RubyOnRails