mailiverse/install/create-server-account-user.remote
2013-09-01 12:19:41 -04:00

22 lines
444 B
Plaintext
Executable File

set -x
USER=$1
if [ "$USER" == "root" ]
then
USER_DIR='.'
else
USER_DIR="/home/$USER"
sudo useradd -m $USER
sudo usermod -s /bin/bash $USER
fi
sudo mkdir $USER_DIR/.ssh
cat authorized_keys | sudo tee -a $USER_DIR/.ssh/authorized_keys
sudo chown $USER $USER_DIR/.ssh $USER_DIR/.ssh/*
sudo chgrp $USER $USER_DIR/.ssh $USER_DIR/.ssh/*
sudo chmod 0700 $USER_DIR/.ssh
sudo chmod 0644 $USER_DIR/.ssh/authorized_keys
sudo chmod 0700 $USER_DIR