Last Updated: February 25, 2016
·
757
· jabbrwcky

Set up capistrano deploy user on OS X

After some googling and some experiments I found a way to set up a Capistrano deploy user on OS X via SSH. (You need to be able to execute commands as root via sudo)

Here is the steps you need to execute:

dscl . -create /Users/deploy
dscl . -create /Users/deploy UserShell /bin/bash
dscl . -create /Users/deploy RealName "Capistrano Deployment“

dscl . -list /Users UniqueID | sort -k 2,2 -n # list available user ids 
# Pick $userId from the output of the listed users
# IDs < 1000: system account, >1000: user account

dscl . -create /Users/deploy UniqueID $userId #next available user id (system Account)

dscl . -create /Users/deploy PrimaryGroupID 20 #group Staff

dscl . -create /Users/deploy NFSHomeDirectory /Users/deploy

createhomedir -c -u deploy 2>&1 | grep -v "shell-init"

dseditgroup -o edit -t user -a deploy    com.apple.access_ssh

The last command is required for the capistrano user to access the OS X machine via SSH.

Happy deploying via Capistrano!