Skip to content

Instantly share code, notes, and snippets.

@wynemo
Created October 27, 2017 05:50
Show Gist options
  • Save wynemo/85787b1398002f8af6ec170dcc7fefdc to your computer and use it in GitHub Desktop.
Save wynemo/85787b1398002f8af6ec170dcc7fefdc to your computer and use it in GitHub Desktop.
run mosh on centos 6
# sudo yum install gcc-c++
# sudo yum install protobuf-devel
$ wget -c https://mosh.org/mosh-1.3.2.tar.gz
$ tar xf mosh-1.3.2.tar.gz
$ cd mosh-1.3.2
$ ./configure
$ make
# make install
$ cat mosh.sh
host=$1
port=$2
name=$3
remote_ip=`host $host | awk '/has address/ { print $4 ; exit }'` #remote ip
info=`ssh -p $port $name@$host -t "mosh-server" | grep 'MOSH CONNECT' | sed 's/MOSH CONNECT//g' | tr -d '\r\n'`
read -a port_key <<< "${info}"
port=${port_key[0]}
key=${port_key[1]}
echo "///$port///"
echo "///$key///"
MOSH_KEY=$key mosh-client $remote_ip $port
$ sh mosh.sh server_address server_ssh_port user_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment