mailiverse/install/create-server-account-user.remote

22 lines
444 B
Plaintext
Raw Normal View History

2013-08-16 15:34:54 -04:00
set -x
USER=$1
2013-09-01 12:19:41 -04:00
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