博文

目前显示的是标签为“Ubuntu”的博文

ubuntu18.04 mysql5.7/mariadb10.1 set root password

1. Login (use sudo to login without password) sudo mysql -u root 2. Check SELECT User,Host FROM mysql.user; 3. Delete out root user DROP USER 'root'@'localhost'; 4. Create new root user CREATE USER 'root'@'%' IDENTIFIED BY 'your_password'; 5. Grant permissions GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION; 6. FLUSH PRIVILEGES;

Use Nmap to Scan Ports (cheat sheet)

1.Basic scan nmap 41.22.10.1 nmap yourdomain.com 2.Scan specific ports nmap -p 1-65535 41.22.10.1 nmap -p 1,443 41.22.10.1 3.Scan multipul ips nmap 1.1.1.1 1.1.1.2 nmap 1.1.1.1,2,3,4 (This will scan 1.1.1.1 1.1.1.2 1.1.1.3 1.1.1.4) nmap 1.1.1.1-4 nmap 1.1.1.* nmap 1.1.1.0/28 4.Scan popular ports nmap --top-ports 20 1.1.1.1 (Scan 20 ports of 1.1.1.1) 5.Scan target from a file nmap -iL list.txt 6.Scan an Service detection nmap -A -T4 1.1.1.1 (-A is for service detection. -T4 speeds up this operation) 7.Detect Service/Daemon nmap -sV 1.1.1.1 8.Scan using UDP/TCP nmap -sT 1.1.1.1 (For TCP) nmap -sU 1.1.1.1 (For UDP) 9.Vulnerability detection nmap -Pn --script vuln 1.1.1.1 10.Launch DOS Attack nmap 1.1.1.1 -max-parallelism 800 -Pn --script http-slowloris --script-args http-slowloris.runforever=true 11.Lauch brute force attacks nmap -sV --script http-wordpress-...

Ubuntu 16.04: Redis installation

Step 1: Install Redis: >sudo apt-get install redis-server Step 2: Configuration >sudo vim /etc/redis/redis.conf Change the following lines maxmemory 128mb maxmemory-policy allkeys-lru Step 3: Restart service sudo service redis restart Step 4: You may try the following commands to see if the redis is working properly Monitor redis-cli monitor Command line tool redis-cli Clean cache flushall

Connecting via shadowsocks socks5h via Linux command line

Please note that here we use socks5h instead of socks5. socks5h is a specified version of socks5 which means solve host name via proxy too. export http_proxy="socks5h://192.168.31.114:1081" export https_proxy=$http_proxy

Why cannot mysqld be found?

In some LAMP server, you may be confused that mysqld service cannot be found. For example, when using the command: > sudo service msyqld restart It just failed and said something like mysqld.service didn't exist. When this happens, please try: >sudo service  mariadb restart Hope this will help.

Cheat sheet: Ubuntu 16.04 + NodeJS + React + Grunt + Babel + Browserify Configuration

1. Install NodeJS >sudo apt-get install nodejs nodejs-legacy 2. Create a project using npm >npm init 3. Install React >npm install --save react react-dom 4. Install Babel and plugins > npm install --save-dev grunt-babel > npm install babel-preset-env --save-dev > npm install --save-dev babel-plugin-syntax-jsx The last command line is for JSX which is highly recommended by React. 5.Config .babelrc { "plugins": ["syntax-jsx"], "presets": [ ["env", { "targets": { "chrome": 52, "browsers": ["last 2 versions", "safari 7"] } }] ] } 6.Install Grunt and plugins >npm install -g grunt-cli >npm install grunt --save-dev >npm install grunt-contrib-jshint --save-dev 7. Config Grunt file module.exports = function(grunt) { // Project configuration. grunt.initConfig({ pkg: grunt.file.readJSON('package.j...

Use proxy chains to access socks proxy in command line in 3 steps - Linux

Step 1. Install sudo apt-get install proxychains Step 2. Config port sudo vim /etc/proxychains.conf Step 3. Usage proxychains <your command>

MongoDB study note (2): security configurations - Setup username and password, Bind interface and Iptables (on Ubuntu 16.04/mongoDB 3.4)

Setting up username and password First, check your /etc/mongod.conf to confirm it is not in the auth mode. Add comment symbol '#' of the following code and restart mongod service: #security:   #authorization: enabled sudo service mongod restart Then, Connect to local mongodb: mongo --port 27017 Switch to admin database: use admin Create admin user: db.createUser({ user: "admin", pwd: "<your password>", roles: [{ role: "userAdminAnyDatabase", db: "admin" }] }) Grant Roles: db.grantRolesToUser('admin',[{ role: "root", db: "admin" }]) Check if successfully added (should return 1): db.auth("admin", "<your password>") Exit mongo client: exit Enable the auth mode in your /etc/mongod.conf by activating the following lines and then restart the service: security:   authorization: enabled sudo service mongod restart Go back to...

MongoDB study note (1): Installation and Run (on Ubuntu 16.04/MongoDB 3.4)

Installation Command list: (Ubuntu 16.04 for example. Other systems please refer to https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/) sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6 echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list sudo apt-get update sudo apt-get install -y mongodb-org Run Command list: sudo service mongod start

How to deal with the ERROR: D-Bus library appears to be incorrectly set up; failed to read machine uuid: Failed to open “/var/lib/dbus/machine-id”

After I deployed the scrapy-splash, I ran my spider and encountered an ERROR: D-Bus library appears to be incorrectly set up; failed to read machine uuid: Failed to open “/var/lib/dbus/machine-id” It seemed that no affection to the results but really annoying. After I tried a few solutions from Google, finally I solved it with this command: dbus-uuidgen > /var/lib/dbus/machine-id Good Luck!

Using Haproxy + shadowsocks (ha + ss) to setup multi ss backend and load balance

*Install haproxy > sudo apt-get install haproxy *Configure haproxy >vim /etc/haproxy/haproxy.cfg global     ulimit-n 51200     log /dev/log local0     log /dev/log local1 notice     chroot /var/lib/haproxy     pidfile /var/run/haproxy.pid     user haproxy     group haproxy     daemon defaults     log global     mode tcp     option dontlognull     timeout connect 5000       timeout client 50000     timeout server 50000 frontend ss-in     mode tcp       bind $Your_IP:8002     default_backend shadowsocks backend shadowsocks     mode tcp       balance roundrobin         server ss1 $Your_SS_IP1:$Your_SS_PORT1 maxconn 20480         server ss2 $Your_SS_IP2:$Your_SS_PORT2 maxconn 20480 ...

Setup shadowsocks in Ubuntu 16.04 server [client & server]

1.  Setup Server *Install shadowsocks > apt-get install shadowsocks *Configure config file in /etc/shadowsocks/config.json {     "server":"Your server ip",     "server_port":your server port,     "local_address": "127.0.0.1",     "local_port":1080,     "password":"You Password",     "timeout":300,     "method":"aes-256-cfb",     "fast_open": false,     "workers": 1 } *Restart service > sudo /etc/init.d/shadowsocks restart 2. Setup Client *Install shadowsocks client >sudo apt-get install python-pip >sudo pip install shadowsocks *Create config file in /etc/shadowsocks.conf.json {     "server":"Your server ip",     "server_port":your server port,     "local_address":"your local ip",     "local_port":your local port,     "pas...