## On ther server
# Creating new user
sudo adduser newuser
# Setup password
sudo passwd newuser
# Add user to wheel group
sudo usermod -G wheel newuser
# Make sure the target user added to wheel group
grep wheel /etc/group
# Add sudo permisison to the target user
sudo visudo
# newuser ALL=(ALL) NOPASSWD: ALL
## On the local
# Move into .ssh dir
cd ~/.ssh
# Setup the key pair
ssh-keygen -t rsa -f id_rsa_newuser
# copy the pub key
cat id_rsa_newuser.pub | pbcopy
## On the server
cd /home/newuser
## Create the .ssh dir
mkdir .ssh
# paste the pub key
vi .ssh/authorized_keys
# Setup the group
chown -R newuser:newuser ./.ssh
# Permission settings
chmod 700 .ssh && chmod 600 .ssh/authorized_keys
## ALl done! Try to test the login as newuser