Skip to content

Instantly share code, notes, and snippets.

View SebKay's full-sized avatar

Seb Kay SebKay

View GitHub Profile
@SebKay
SebKay / generate-ssh-key.sh
Last active September 3, 2019 12:52
Create New SSH Key
ssh-keygen -t rsa -C "email@email.com"
@SebKay
SebKay / copy-ssh-key.sh
Created September 3, 2019 12:51
Copy SSH Key to Clipboard
pbcopy < ~/.ssh/id_rsa.pub
@SebKay
SebKay / restart-apache.sh
Created September 3, 2019 12:53
Restart Apache
sudo service apache2 restart
@SebKay
SebKay / change-directory-owner.sh
Created September 3, 2019 12:56
Change owner of directory to web server user
sudo chown www-data:www-data /var/www/html -R
@SebKay
SebKay / add-ssh-key-ubuntu.sh
Last active September 18, 2019 09:39
Add SSH key on Ubuntu
# Add to default keys
echo -e '[SSH_KEY]\n' >> ~/.ssh/authorized_keys
chmod 0600 ~/.ssh/authorized_keys
# Add to specific user
echo -e '[SSH_KEY]\n' >> /home/[USER]/.ssh/authorized_keys
chmod 0600 /home/[USER]/.ssh/authorized_keys
@SebKay
SebKay / restart-ubuntu-server.sh
Last active October 2, 2019 10:21
Restart an Ubuntu server
# Tested on Ubuntu 14.04 and 18.01
sudo shutdown -r now
@SebKay
SebKay / restart-apache.sh
Last active October 2, 2019 10:20
Restart the Apache2 service
sudo service apache2 restart
@SebKay
SebKay / change-file-permissions-ubuntu.sh
Last active December 11, 2019 08:18
Change folder and/or file permissions on Ubuntu
find /var/www/html -type f -exec chmod 644 {} \;
@SebKay
SebKay / lets-encrypt-ssl-wildcard.sh
Last active March 9, 2021 21:50
Install Let's Encrypt Wildcard Certificate
sudo certbot --server https://acme-v02.api.letsencrypt.org/directory -d DOMAIN.com -d *.DOMAIN.com --manual --preferred-challenges dns-01 certonly
@SebKay
SebKay / rsync-from-computer-to-server.sh
Created October 2, 2019 10:20
Copy files from your local machine to a server using Rsync
rsync -v -a -z --owner=www-data --group=www-data -e ssh -p 22 -o StrictHostKeyChecking=no LOCAL_PATH USER@IP:SERVER_PATH