Skip to content

Instantly share code, notes, and snippets.

@TravisMullen
Last active March 9, 2019 19:27
Show Gist options
  • Save TravisMullen/79262bb4b92e4ddefb0d0d7f68aba689 to your computer and use it in GitHub Desktop.
Save TravisMullen/79262bb4b92e4ddefb0d0d7f68aba689 to your computer and use it in GitHub Desktop.
Change Raspi Pi default username.
echo "What is your new username?"
read $USER
# Close putty and connect again this time with the following credentials
# Username: root
# Password: <new password you created>
# Now we will change the pi username to something different, replace $NAME with whatever you pick
sudo usermod -l $NAME -d /home/$NAME -m pi
sudo chown $NAME /home/$NAME
# Close putty and connect again this time with your new username
# Run the following commands
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get install ufw
# sudo apt-get install libtool autotools-dev autoconf libdb-dev libminiupnpc-dev dh-autoreconf libdb++-dev libboost-all-dev libssl-dev pkg-config joe ufw protobuf-compiler libprotobuf-dev libqt4-dev
# Now we will configure the firewall to only allow ports 22 for SSH and 50472 for the masternode
sudo ufw allow ssh/tcp
sudo ufw limit ssh/tcp
# sudo ufw allow 51472/tcp
sudo ufw logging on
sudo ufw enable
# sudo reboot
# After a few minutes connect back with Putty and check the status of the firewall
sudo ufw status
# This is my setup
sudo ufw default deny outgoing
sudo ufw default deny incoming
sudo ufw allow 993
sudo ufw allow 6969
sudo ufw allow out 53
sudo ufw allow out http
sudo ufw allow out https
sudo ufw allow out 465
sudo ufw allow out 587
sudo ufw allow out 993
sudo ufw allow out 6969
# This works well with Ubuntu 16.04: Everything works properly
# sudo ufw status numbered (the reasoning)
@TravisMullen
Copy link
Author

[ 1] 993 ALLOW IN Anywhere (thunderbird)
[ 2] 6969 ALLOW IN Anywhere (qbittorrent)
[ 3] 53 ALLOW OUT Anywhere (dns)
[ 4] 80 ALLOW OUT Anywhere (http)
[ 5] 443 ALLOW OUT Anywhere (https)
[ 6] 465 ALLOW OUT Anywhere (thunderbird gmail) (*send)
[ 7] 587 ALLOW OUT Anywhere (thunderbird hotmail) (*send)
[ 8] 993 ALLOW OUT Anywhere (thunderbird)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment