7 # TODO: a more complete VPS setup
9 # TODO would $EUID be better?
10 if [ "root" != "$(whoami)" ]; then
11 echo "webi adduser: running user is already a non-root user"
16 #apt-get -y install curl wget rsync git
19 # TODO: might there be a better name?
20 # me, this, user, self, person, i, who, do, tron
21 adduser --disabled-password --gecos "" me
22 my_password=$(openssl rand -hex 16)
23 printf "$my_password"'\n'"$my_password" | passwd me
25 echo "me ALL=(ALL:ALL) NOPASSWD: ALL" | tee /etc/sudoers.d/me
26 sudo -i -u me bash -c 'ssh-keygen -b 2048 -t rsa -f /home/me/.ssh/id_rsa -q -N ""'
27 mkdir -p /home/me/.ssh/
28 cp -r $HOME/.ssh/authorized_keys /home/me/.ssh/
29 chmod 0600 /home/me/.ssh/authorized_keys
30 chown -R me:me /home/me/.ssh/
32 # Install webi for the new user
33 sudo -i -u me bash -c 'curl -fsSL https://webinstall.dev/webi | bash' \
34 || sudo -i -u me bash -c 'wget -q -O - https://webinstall.dev/webi | bash'
36 # TODO ensure that ssh-password login is off
38 echo "Created user 'me' with password '$my_password'"