Linux: SSH
Config file
sudo nano /etc/ssh/sshd_config
Welcome message
Two files must be edited:
/etc/motd (message of the day)
/etc/ssh/sshd_config: Change the setting PrintLastLog to "no", this will disable the "Last login" message.
Convert rsa to ppk
puttygen keyname -o keyname.ppk
Avoid broken pipe
2 options:
1:
create file: /home/user/.ssh/ssh_config with the following content: (client side)
HashKnownHosts yes GSSAPIAuthentication yes GSSAPIDelegateCredentials no ServerAliveInterval 120
(server side)
1 $ echo "ServerAliveInterval 60" >> ~/.ssh/config
2:
echo 60 > /proc/sys/net/ipv4/tcp_keepalive_time
Shell script to reconnect on broken pipe:
#!/bin/sh
#This is an SSH-D proxy with auto-reconnect on disconnect
#Created by Liang Sun on 28, Sep, 2011
#Email: i@liangsun.org
i=0
while test 1==1
do
remote_ip=YOUR_REMOTE_IP
remote_user=YOUR_REMOTE_USER
local_port=YOUR_LOCAL_PORT
exist=`ps aux | grep $remote_user@$remote_ip | grep $local_port`
#echo $exist
if test -n "$exist"
then
if test $i -eq 0
then
echo "I'm alive since $(date)"
fi
i=1
else
i=0
echo "I died... God is bringing me back..."
ssh $remote_user@$remote_ip -f -N -D 0.0.0.0:$local_port
fi
sleep 1
done