-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
64 additions
and
6 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# if the file /postinstall-has-run exists, then the postinstall script has already run and exit gracefully | ||
if [ -f /postinstall-has-run ]; then | ||
exit 0 | ||
fi | ||
|
||
apt update | ||
apt install -y openssh-server vim unminimize sudo nnn git | ||
unminimize | ||
|
||
# ssh | ||
echo "PermitRootLogin no" >> /etc/ssh/sshd_config | ||
echo "PasswordAuthentication no" >> /etc/ssh/sshd_config | ||
service ssh restart | ||
|
||
# user | ||
adduser --disabled-password --gecos "" $USERNAME | ||
echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers | ||
cp /authorized_keys /home/$USERNAME/.ssh/authorized_keys | ||
chown $USERNAME:$USERNAME /home/$USERNAME/.ssh/authorized_keys | ||
chmod 600 /home/$USERNAME/.ssh/authorized_keys | ||
|
||
# node | ||
|
||
|
||
|
||
# If everything runs successfully, don't bother running next startup | ||
touch /postinstall-has-run |