set up sshfs as a non-root user on linux

  1. sudo apt-get install sshfs
    sudo usermod -a -G fuse uid: add uid to fuse group
    /etc/fuse.conf: comment out user_allow_other.
    /etc/modules: add fuse module
    sshfs uid@remotehost:/home/uid /home/uid/mnt/desktoplinux  -o allow_other
Posted in sshfs, Uncategorized | Tagged | Leave a comment

measure network speed with netcat

  • destination: sudo nc -lkv 9999 > /dev/null
  • src: dd if=/dev/zero bs=1024K count=512 | nc -v 10.5.5.21 9999 (copy 10meg data with block size 16k)
Posted in netcat | Tagged | Leave a comment

port forwarding

  • TCP port forwarding: SSH port forwarding/reverse port forwarding, iptables.
  • SSL: stunnel runs in client mode talks to stunned runs in server mode
  • UDP and TCP: socat
Posted in stunnel | Tagged | Leave a comment

How to install mediagoblin

Posted in Uncategorized | Leave a comment

How to get the external public IP via ssh port forwarding

  • ssh -T -L 7080:ipecho.net:80 <production machine alias> : there is a server listening on port 7080 locally forwarding the traffic to ipecho.net:80.
  • curl -H “host:ipecho.net” http://localhost:7080/plain; echo
  • “ipecho.net can be replaced with ifconfig.me etc.
Posted in Uncategorized | Leave a comment

ssh local port forwarding for testing LinkedIn

The Problem

How to reproduce the issue from a dev machine that has SSH access to the production cluster. 

  • Python code that invokes the LinkedIn API.
  • On dev machine, run ” sudo ssh -L 443:api.linkedin.com:443 production_id@production_ip”, this will route the localhost:443 to api.linkedin.com:443 via a target production machine.
  • DNS spoofing such as dnsmasq:

dnsmasq.conf:addn-hosts=/etc/dnsmasq.hosts

dnsmasq.hosts: “127.0.0.1 api.linkedin.com”

sudo service dnsmaq restart

Posted in ssh | Leave a comment

install pip on centos

According to https://pip.pypa.io/en/latest/installing.html,

curl https://bootstrap.pypa.io/get-pip.py | sudo python –

Posted in Uncategorized | Tagged | Leave a comment