Archive

Archive for October, 2012

enable SSH for new non-admin on OSX

October 1, 2012 Leave a comment

Pick a suitable UID and GID :

$ sudo dscl . -list /Groups PrimaryGroupID | sort -n -k2
$ sudo dscl . -list /Users UniqueID |sort -n -k2

Add the user :

$ sudo dscl . -create /Users/newuser
$ sudo dscl . -create /Users/newuser UserShell /bin/bash
$ sudo dscl . -create /Users/newuser RealName "New User"
$ sudo dscl . -create /Users/newuser UniqueID "503"
$ sudo dscl . -create /Users/newuser PrimaryGroupID "20"
$ sudo dscl . -create /Users/newuser NFSHomeDirectory /Users/newuser

Create the users home directory :

$ sudo mkdir /Users/newuser
$ sudo chown newuser:staff /Users/newuser
$ sudo chmod 700 /Users/newuser

View the users details :

$ sudo dscl . -read /Users/newuser

Set the users password

$ sudo dscl . -passwd /Users/newuser PASSWORD

Add them to the allowed SSH users list :

$ sudo dseditgroup -o edit -a newuser -t user com.apple.access_ssh
$ sudo dseditgroup com.apple.access_ssh

Tags: