Skip to content

Instantly share code, notes, and snippets.

View rick4470's full-sized avatar

Rick rick4470

View GitHub Profile
sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql
rick@ubuntu:~$ mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.7.17-0ubuntu0.16.04.2 (Ubuntu)
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
@rick4470
rick4470 / gist:cb6e252e23965c5f38afa7b65fec8a3c
Created April 6, 2017 18:00
Install mysql_secure_installation
sudo mysql_secure_installation
sudo apt-get install mysql-server
sudo apt-get update
sudo apt-get install apache2
@rick4470
rick4470 / gist:2cb06a2954991438f0f9d97ccec26408
Created March 30, 2017 22:24
Block all traffic to 27017
iptables -I INPUT -p tcp -s 0.0.0.0/0 --dport 27017 -j DROP
iptables -I INPUT -p tcp -s 127.0.0.1 --dport 27017 -j ACCEPT
iptables -I INPUT -p tcp -s <IP GOES HERE> --dport 27017 -j ACCEPT
iptables-save > /etc/iptables.conf # Save this changes to file
touch /etc/network/if-up.d/iptables # Create file to call conf from
echo "iptables-restore < /etc/iptables.conf" >> /etc/network/if-up.d/iptables # Add this line to this file
chmod +x /etc/network/if-up.d/iptables # Make the script executable
@rick4470
rick4470 / gist:63871b2abcde1932ecad54fd8755c48e
Created March 30, 2017 22:17
Connect to MongoDB with a Connection String URI
url: `mongodb://${config.user}:${config.password}@${config.db}?authSource=admin&w=1'
@rick4470
rick4470 / gist:e4f9a7b790933e00a6f6eda416636439
Created March 30, 2017 22:09
How to login with credentials to MongoDB 2.6?
mongo --port 27017 -u "username" -p "STRONG PASSWORD GENERATED" --authenticationDatabase "admin"
service mongodb restart
auth = true
bind_ip = 127.0.0.1