Created
March 12, 2022 13:37
-
-
Save sonnyit/f27c4a485f88acdf686a23e6607f46a6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| RED='\033[0;31m'; | |
| NC='\033[0m'; # No Color | |
| GREEN='\033[0;32m'; | |
| YELLOW='\033[1;33m'; | |
| CWD=`pwd`; | |
| delay_after_message=3; | |
| if [[ $EUID -ne 0 ]]; then | |
| echo "This script must be run with sudo (sudo -i)" | |
| exit 1 | |
| fi | |
| read -p "Please enter your username: " target_user; | |
| if id -u "$target_user" >/dev/null 2>&1; then | |
| echo "User $target_user exists! Proceeding.. "; | |
| else | |
| echo 'The username you entered does not seem to exist.'; | |
| exit 1; | |
| fi | |
| # function to run command as non-root user | |
| run_as_user() { | |
| sudo -u $target_user bash -c "$1"; | |
| } | |
| # run_as_user "touch test.txt" | |
| SSH_KEYS=./dot.ssh.zip | |
| if [ -f "$SSH_KEYS" ]; then | |
| printf "${YELLOW}Installing SSH Keys${NC}\n"; | |
| sleep $delay_after_message; | |
| run_as_user "rm -rf /home/ibnyusrat/.ssh" | |
| run_as_user "touch /home/${target_user}/.zshrc"; | |
| run_as_user "unzip ${SSH_KEYS} -d /home/${target_user}/" | |
| apt install sshuttle -y | |
| run_as_user "echo 'sshuttle_vpn() {' >> /home/${target_user}/.zshrc"; | |
| run_as_user "echo ' remoteUsername='user';' >> /home/${target_user}/.zshrc"; | |
| run_as_user "echo ' remoteHostname='hostname.com';' >> /home/${target_user}/.zshrc"; | |
| run_as_user "echo ' sshuttle --dns --verbose --remote \$remoteUsername@\$remoteHostname --exclude \$remoteHostname 0/0' >> /home/${target_user}/.zshrc"; | |
| run_as_user "echo '}' >> /home/${target_user}/.zshrc"; | |
| else | |
| printf "${RED}Zip file containing SSH Keys (dot.ssh.zip) was not found in the script directory, therefore keys were not installed ${NC}\n"; | |
| sleep 10; | |
| fi | |
| apt update; | |
| #Install Z Shell | |
| printf "${YELLOW}Installing ZSH (Shell)${NC}\n"; | |
| sleep $delay_after_message; | |
| apt install zsh -y | |
| sleep 2; | |
| chsh -s /bin/zsh | |
| # Remove thunderbird | |
| printf "${RED}Removing thunderbird completely${NC}\n"; | |
| sleep $delay_after_message; | |
| apt-get purge thunderbird* -y | |
| # Some basic shell utlities | |
| printf "${YELLOW}Installing git, curl and nfs-common.. ${NC}\n"; | |
| sleep $delay_after_message; | |
| apt install git -y | |
| apt install curl -y | |
| # apt install nfs-common -y | |
| # apt install preload -y | |
| # Enable Nautilus type-head (instead of search): | |
| printf "${YELLOW}Enabling nautilus typeahead${NC}\n"; | |
| sleep $delay_after_message; | |
| add-apt-repository ppa:lubomir-brindza/nautilus-typeahead -y | |
| #Install Node Version Manager | |
| printf "${YELLOW}Installing Node Version Manager${NC}\n"; | |
| sleep $delay_after_message; | |
| run_as_user "wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | zsh"; | |
| printf "${YELLOW}Installing Latest LTS Version of NodeJS${NC}\n"; | |
| sleep $delay_after_message; | |
| run_as_user "source /home/${target_user}/.zshrc && nvm install --lts"; | |
| #Install VIM | |
| printf "${YELLOW}Installing VIM${NC}\n"; | |
| sleep $delay_after_message; | |
| apt install vim -y | |
| #Install Open-SSH Server | |
| printf "${YELLOW}Installing OpenSSH Server ${NC}\n"; | |
| sleep $delay_after_message; | |
| apt install openssh-server -y | |
| systemctl enable ssh | |
| systemctl start ssh | |
| #Install Chromium | |
| printf "${YELLOW}Installing chromium-browser${NC}\n"; | |
| sleep $delay_after_message; | |
| apt install chromium-browser -y | |
| apt dist-upgrade -y; | |
| chsh -s /bin/zsh | |
| update-initramfs -u |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment