Home > Uncategorized > enable SSH for new non-admin on OSX

enable SSH for new non-admin on OSX

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

Advertisements
Tags:
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: