adduser {{username}}
usermod -aG sudo {{username}}
passwd {{username}}
mkdir /home/{{username}}/.ssh
vi /home/{{username}}/.ssh/authorized_keys
Copy a SSH from your local machine e.g. ~/.ssh/id_rsa.pub
Paste into the authorized_keys
file on the remote machine
ssh {{username}}@{{ip_address}}
vi /etc/ssh/sshd_config
(generally about halfway down the file)
PasswordAuthentication no
Note: you may have to run some of this as a Super User $ su
apt-get update && apt-get dist-upgrade -y
apt-get autoremove -y
apt-get update
apt-get install zsh && git-core
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh
chsh -s `which zsh`
Note: Leave (exit
) and re-login (ssh {{username}}@{{ip_address}}
)
apt-get install -y build-essential python-software-properties python g++ make fail2ban curl git htop ntp ntpdate unzip nano
dpkg-reconfigure tzdata
sudo apt-get install apache2
sudo ufw app list
sudo ufw allow in "Apache Full"
sudo ufw allow in "OpenSSH"
sudo ufw enable
sudo ufw status verbose
sudo systemctl restart apache2
sudo chgrp -R www-data /var/www/html
sudo find /var/www/html -type d -exec chmod g+rx {} +
sudo find /var/www/html -type f -exec chmod g+r {} +
sudo chmod 775 -R /var/www/html
sudo adduser {{username}} www-data
sudo vi /etc/apache2/apache2.conf
Note: Use ?
to find in Vim and search for Directory /var/www/
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
sudo vi /var/www/html/.htaccess
Options +Indexes
<Files *>
AuthType Basic
AuthName "Please enter your username and password."
AuthUserFile /var/www/html/.htpasswd
Require valid-user
</Files>
Note: This creates a basic HTTP authorization Ref: MDN HTTP authentication
sudo htpasswd -bc .htpasswd {{user}} {{password}}
Note: Restart Apache for good measure
sudo systemctl restart apache2
sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql
sudo vi /etc/apache2/mods-enabled/dir.conf
// Change From
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
// To
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
Ref: Helpful Stack Overflow on Permissions
sudo apt-get install php-cli