mirror of
https://github.com/moparisthebest/mailiverse
synced 2024-11-18 07:04:59 -05:00
22 lines
444 B
Plaintext
Executable File
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
|