Last active
November 27, 2018 23:40
-
-
Save mxwell/32f42c0e1dfd346f9a4cef1b2b123b4d to your computer and use it in GitHub Desktop.
Script for initial configuration of a clean Linux (read 'Ubuntu') host
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
set -xe | |
export NEW_USER=murat | |
export GITHUB_LOGIN=mxwell | |
export HOST_NAME=REMOTE | |
export NEW_HOME=/home/$NEW_USER | |
sudo useradd -s "/bin/bash" $NEW_USER | |
sudo adduser $NEW_USER sudo | |
echo "$NEW_USER ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers.d/90-cloud-init-users | |
sudo mkdir -p $NEW_HOME/.ssh | |
wget -O - "https://github.com/${GITHUB_LOGIN}.keys" | sudo tee -a $NEW_HOME/.ssh/authorized_keys | |
TMUX_CONF=$NEW_HOME/.tmux.conf | |
echo "set-option -g prefix C-a" | sudo tee -a $TMUX_CONF | |
echo "set-option -g set-titles on" | sudo tee -a $TMUX_CONF | |
echo "set-option -g set-titles-string ${HOST_NAME}" | sudo tee -a $TMUX_CONF | |
sudo chown -R $NEW_USER:$NEW_USER $NEW_HOME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment