wynemo
10/27/2017 - 5:50 AM

run mosh on centos 6

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