FREE SG based IPv4 port forwarding / concentrator service for their Raspberry PI

Why?

Running ssh-loop-sh effectively "phones home" and allows you to connect to it, no matter how it's deployed.

Name Port Mac Address Local IP Origin IP Origin port Host Host port Notes
888 offline since Tue Oct 27 20:11:27 +08 2015
X1C3 offline since Thu May 12 10:22:56 +08 2016
alice offline since Sun Aug 6 16:53:31 +08 2017
dave offline since Wed Mar 2 01:16:56 +08 2016
eddie offline since Tue Jun 23 14:48:04 +08 2015
hall offline since Thu May 12 10:25:52 +08 2016
hendry 10021b8:27:eb:39:2a:75192.168.6.68202.172.56.448886128.199.115.23222online since Sat Sep 23 23:04:06 +08 2017
hgspider offline since Sat Jun 3 22:32:50 +08 2017
latitude 1000878:4b:87:a3:53:2c10.0.0.93122.11.140.2845249128.199.115.23222online since Thu Sep 21 14:33:01 +08 2017
mbp offline since Sun Jan 1 12:35:02 +08 2017
mcheng 10059b8:27:eb:90:4e:ed192.168.6.192202.172.56.443438128.199.115.23222online since Tue Sep 12 17:03:45 +08 2017
melody offline since Tue Aug 29 22:11:42 +08 2017
meridian 1005178:4b:87:a4:c6:60192.168.6.98202.172.56.445456128.199.115.23222online since Tue Sep 12 03:31:17 +08 2017
mike-pi offline since Sun May 25 16:07:44 +08 2014
mosfet offline since Tue Sep 19 22:18:54 +08 2017
pickfire offline since Thu Aug 17 23:12:18 +08 2017
proxy-test offline since Thu Apr 13 14:30:45 +08 2017
rpi2 offline since Fri Apr 24 12:07:12 +08 2015
soundboard offline since Sat Jun 13 17:21:00 +08 2015
uptown 10003b8:27:eb:04:5e:25192.168.88.8960.48.63.1157110128.199.115.23222online since Sun Sep 17 15:44:18 +08 2017
x220 offline since Tue May 10 23:01:57 +08 2016
xp-rpdev 1015400:e0:4c:53:44:5810.0.0.51122.11.140.2857938128.199.115.23222online since Sun Sep 24 17:48:08 +08 2017
xp-spider offline since Thu Jun 4 14:31:18 +08 2015

Note: Please do not allow password logins by adding PasswordAuthentication no to your /etc/ssh/sshd_config.

Connecting to your PI

port=\$(curl -s http://pi.dabase.com/\$NAME/ | tail -n1 | awk '{print \$3}')
test "\$port" && ssh pi.dabase.com -p \$port # -o "StrictHostKeyChecking no" -o UserKnownHostsFile=/dev/null

Setup

ssh-keygen without a password.

Send hendry+pi@iki.fi your public key /root/.ssh/id_rsa.pub. Once he's added your key, run ssh-loop.sh.

Make sure you have chmod +x /root/ssh-loop.sh, else you will see a systemd error like: main process exited, code=exited, status=203/EXEC.

To keep it running add to /etc/rc.local like so:

#!/bin/sh -e
/root/ssh-loop.sh &
exit 0

or use a more "modern" systemd service file ssh-loop.service.

How the server works

$ cat /home/pi/.ssh/authorized_keys
command="/home/pi/pilog hendry" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDTK9CFLI4uRI+n5n74WJpvLyS3PdYmgqTDUP/BPRVB9IN8Xt9NZcA5S5/L6VFXujo29rBlLBr4m2jdZoCXKOfoC5VEUEAmX++vDXG42jkzUPLsiMhjJtEgN+YVt3LEkH1REUCDo/AL3SxLVRNvPRHEBLdOyhxmQQrBbosi8rEyjXUsYBY2rhR8RFPcPGpG2NCEjH0gJoLpYIII+BhRRXObCphuhW9QWAzIp7OvxqPjOHDq4HVotcbTWC90ha+n/ZFZ5LOipQG0yQ8Jo5dxbYUZl1iJhKYP2OyTs+3UeIcRnpHvS2Z1+mbzjxpdIVP3sm2HVfXgj+53i7ZtOoQEsNix root@pihsg
command="/home/pi/pilog mbp" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCnl5KVbcN+L4n2Ah25fOqNg6MghYxfmrtaO+l5tBFLS7qiih72nN2wF5jPq6TiFBn/VYd864HLGx+7FQQ1csUSvAVyMepNiTTE2G9PurDsasyEQ0wajDi8GeApf0xifQgsyw5+K/Dos0cfhHfK47NWcJcZCovsvDEydmb2rCEDRp2jFpPVl+lhi1nKESnSu2STcn6NFNg164Ictz7gI0xoFeBie4lBElo5narpO35RImep+NT5noE084C5POHePaeE+IMvtF12K7WC1TiA6I94ArrvtIJPwkwPjJKxyvZ+LUcHEikD0waJTwUySUXPkSSKq+wm2kwT+b7Sfo0uQoHD root@Ruths-MBP.local
command="/home/pi/pilog mosfet" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDMk+ECqxe1NkwsVkYAyOV0C2BX5Q9DF/Q6FtsefES8+UZXpy4mYDjtyAmwmrB39oPFP+TyRVpah9xJksl6ztDMEnJrNGQh/rdK7hNHlYk8Cuq/SR9dXupweiylQmyWuj+eydhmdmUaaRciERQ6dYU0XYmmGAEqqz3G3yzuMGb1Fsl1831hDPJDEd1N/JJ//9kM6HUr2CtwXIqMrbSTbezqhrKrT15Vfv3p7Xl2TLiMwUClu07/Rm+Lyi1f2+ph7UqgCvl5eusyd35hJU1tpBnm8/hYcjhL/BV8VAwYJHlVFihpOO4vUrHgYy6qDjTyYSqQ1/WrOD2CJDqVTYrtmI3b root@mosfet
command="/home/pi/pilog daniepi" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDl3AlHo+x0WIN/NMt5VJDt564OAT5kJUk6fLugx8UKZqj824LP/bBx4u6WHYVX3MAFyFqLsHyhtXtUJuYvQwFcRqiUU9ofxNp5m/KdaS72NYOs6y1CpPUGpOAfW1vszqL73iE9MzPNvvTSmHVvFTio5Fr2DaMxnSPyRf6Vwk+AMBxaf8nFJNfiRGsHgcVIraTGoC0kf8gwGz05OshCu+IUeAmw+QMZtiiXW4s4GhGBpjbK6ReWlFdFWYaO8pYX9z51YNio3ru3xVQ4TPzQaktU3WgWTBOBjOCF9RMbz9mUv3xtXeqDRib5bB3O+RLSRwFa3fr5AtfuVXGFJMecxN6Z root@daniepi
command="/home/pi/pilog mcheng" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDHI1zSLdVjddq5/iJAO6FLFtmLRG9w+KBXonK2dmaPZT4l+sGHUQc7U+9AdGztv+nxDvxtpKNNiP+0mEA8t+J8pS/e63En9FyhtMdR06ZArbrPeVYMPcYddOxlpvnICM4JHqJVPxYzrI880o8LBQGzo6g/xcffwOBvZU08Tf3ho/TRUztkZuISUm35Yf27RrsLoAzmhcrbCpYTJ8uITeBbP/uphIpVCwzF1QXrvgfR2/pG5MGnrvyeCC4wOFuLM1grH+/pFPuyp4b+c7kr8axSPwS8D+fBeQC47hBN77TZ+9NcvX2YuZFppMytYHbDvqknDv/+yXWD3SArT6bg46GJ pi@raspberrypi
command="/home/pi/pilog mike-pi" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDbjL113VDayH3Ipiq85BfkIEsM/GmsjPSGgdMzcmG1Fy5MZcwzCExNuW6lfPG4EHgDyc0yyR4L1aFKBottqCzNYWE9NCv6XWfPOYSptuCxmEA0Rs5QgPvK+aW+eT0CGGZo8XwZ7jp8bCh846TSOIltG0NP0PfD+sXpmqzxB8yyJ6pkJ3utFHQCpQ06RA6gWCL7pRiEFuhNdOiM54675edPxxmWuiSTv53qnfFLFL8wxcSlKMJ7oujjqVrc9iG66hjny9SF+fQOyFm3KEb4MUcgCdt9Lnz9xoW63F3utn1GoBKYViuaBhMcNVMcSjNOdfgaN8yt/sGidnWU0oY07gC9 pi@mike-pi
command="/home/pi/pilog soundboard" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDXBZIcxPLrqAOFDbIEjQGzOKpRr7nXu2cVLvGC1pF8evVaMsUTQpgvm2Tzu7Y0nGTNjXWFsS5yVarWkddZ1FeRABQU0cwyEWSQcxxmlgGFO8sskLOG1SEwpko4kqVEN2ggyqHcpHYESPO4WqtSDkZLbPtI9jCqZsMnlrKqf4hWWNnUoUgSfYqEH2zTQc4h88IVXgZhRVQyUm+Zlr6PpzigYROXOP0ym5Q17d7uDoPdm3YNeBNHfK443Zbmz4K3dKGUJHCOssLxx0cNI2+HQUpoy2rFHB65uZFhYXr7dmm460eO70JJhKyv3qEn+chkS+LhOFZsGEX49/wwNYwEEKep root@alarmpi
command="/home/pi/pilog hgspider" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDQlnR4ij8E1sm6orGK0aif/2Tv+4U+ubt6mT1imoiPCNjPDMNbiGtQ0dMsoEhw3qv/XTMOdZaEijhQABEWIhjnC0M/rHCjPcnND5iScdmvXPuOEZ34HSDE6cBZ2BfFBxKsfl3kkVttBWPc4SebEvyI1+YhcPxlHxDsmv7BdKmc1wKEkHg1DnQUhjcUUUoBEXiMbPZEVtmRTD1IgMnoWAsZdgur4fWWC0KyVoP/DHwOMM1ajfb3JdjQJzHDOhe3cCbE6slQrZb392TE+Nw56qjOFbqD5Z2DMVgBcrVv+j4BfgeftJFQp7l+j371xBNoYf18pH2FtwCDNtVSGOlMEU0n root@hgspider
command="/home/pi/pilog xp-rpdev" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC4E69R+ySbESxyYUGg55/xlZHofTR67BhPjKWyOhhA+y0HoMkL+iQVs7g7HbsDZWyj92jDrlrYnjGvNe8AUrE49lPO6InPzuS2Q5tJon+MgroaffgEjzZ5eofjpaXn1yFpK2nhCDX5QlyHhWSsUg6FQrf5dHio0zyGOzXxF9vmddjFZlf62VVJ6THRXT/3Fcdn6t/mVZSUJlZ180MEHb8kp7USCgp0IxWmdID1I8KsGQI8FydYB5k2ZNfj14I3QPt3ryeHUlzkqA9Fc/UTGfWSSjeiIAka3kj7pI6iG9L7g9U7W7cZwrAjvCCAXO71MpGhEpzxzmtYGmwzxSgr3M/5 root@xp-rpdev
command="/home/pi/pilog rpi2" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDPV8NZFUrVukg4j3J5vqREixhpVAa9s2ediidVDNub9/6PsnYyuCjbV30ZExwH/BRN+yVEOPi5H8mOOTkzlNH/QmtEeN5b5t8o4oR3I/rIeJZH0HzqiNwnKut2buZB0LO1NFoEH6NPyK1unqihdujME4DiHBQyGbnRihZlcuDcDsuzU56PdHir+jmaF0dr5uVfTW/hb58lluJoYw7K+ftnH09oEKP03sb5kEMajtxQXGBH47R6f4dHBm5gO/12KKMBNmrjR/TxxTCpjsogi3shNzyGrDR54BOXoxjtv9GoqYq3xdj/iwMRlxcr6IUUGY6CUPAg9AenOk1rqUmD/bIx root@rpi2
command="/home/pi/pilog x220" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDH2Q03Z3pF8nLyQlH6QCtyBTyCMX/XFlEZxZP7nOOP5j1/YlCD2aVFs59aqBtljHmtUmOvFV9fV64m8VGX/3DoQi4Ps7NztCCuos5ulnLFkmOPYlh+ivCaIdeD7FU16uypelrvwzVkBdDDznHsdju28GzTUQGyECnJfok3vLQnT1S1uqThEeEz3CE2cS2BU/rMX03WAKXwNU9siwgdQWyoIgNiW1k2lngTQZdbBUyMJDaGsbjriTGrEtyk2bjAs9p/L6SKm8Uh8mtgiIoSed6L4HluWgA2zJd11HjtrzqvgrTar5C06Rq4StUGcXA+8OEvHKLMuxK1hflyq3i8M2d5 root@x220
command="/home/pi/pilog tvp" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDonbf0Y3/DAGBMNfC6dEiva0wa/Tn04Z2kahK3oycpmdrNRP7qIhIJjvMPXGBi+pvnKPoGrJjIcxZ9YjwRuufUCkYrX2fVH14C0gCGPYm5dpVqwDI/moA6b0on0ZdEcqI9pHgm7SGQmctJPtPk2XJhQ4CSyfCBbKiuxZ/T664UjlSu+WbIXRcIcUdVo18sduMgcVBgYagBA7qf11IIRuzyqL8/n4vlnfS91gmWXrYkWbGzny1EiQsHJW85dRcuT8sFxZ8TW45fTkaiSG8GJ84hO5HPd4wYPiaU0rVyimM9btjvWqCUDZrM46sgd8Ym8e4/Bt9Q4N6JRHk+38E6gRCf root@tvp
command="/home/pi/pilog xp-spider" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDFKKi+Pet57ZX46xlAM+FHFmKzQ39CSIg3t9oC2Fm1SvFv87d2j7FeS3wd2+pzmYicEMw9LVRPtOQFsc4k1Obd5Q7MGiu339YbIbaWYrdB6qZmy77bsuxHltMTvmv3pIjOAstJ2yK66UVKCfRhrm+svgL7tyWutPj4kXi2MvzezFW5fHUGQKeedvhdYrsYOjdqjXFzUlMYoQ5oEfRvBMJf5Yxq+BJ8HvRJdqJ4Ik6MqWK7ACxIZKqamrJzXEAuDTyGeb2vc4emKUOKFGR/potqnbYS+nbY4pydo2lntQWBA3WTaqkC7fVLFDxxyb7zFxeXyTFQKOCY3By78tsiRe2j root@xp-spider
command="/home/pi/pilog eddie" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCh6wvgCjqgnpX/dcWsT+fm9bNWgUlvG8BzpXhLbMo0A0bgZYZVpUf9DeAeDCK9zD16qXXJ7m7zVGO0r+Ls1BcGhUOQuR19t37Jfc0pHPb6BiOXUc0oKaTJtsNt8F6BnLgJCeMlmi4n+Qu6zgX7KXgb8HTLNVrPryruQVPrvbzgCO40IwcsiB0wrIw+7+LoCE98USbUSB7/XLx7YpBw4XKLR4mg1jQM/tBDMpq+X+bSQnvXbhe9L6vkiQVNtwCy603J1WvxYN7bt4MOa6DF1+J4+DYkeEmbuTjpY5gnTxMdOZb2iyMSu33NR5F27G7dlFMla2fuRrj9fi0s1e/ugGdZ root@obi4
command="/home/pi/pilog melody" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC9cQ5aVUP1GPIvJ10HLHYimqwySKyvJ+gwPZAcgNpnIBlwDmIXozX6JM99R24RuuPY7p7+dWHMK3ilLQ8ueJZH/d0NgDExp1Lo+RvISnheU+VCK9ZBYbV0+G9mk44sNbuA598hlgMlF7HKvUAMJW3PNcyh8kZZFMZ9nEtCGE7xexfm+eiZ8auuNmSO7S1OMeG3k8wGGWsXReiDy3TPrPACbzyvYC9nK1c7g+Pwp9ezwBs2D8I2LMt2S4nbgbTjx4EF1vtHOwzHFGfDzId2UL+qMaj2AF2ADCKdFoenrviCWEI+v2T1FivzQJCgqgpBQOuh5kOoGqFS+ipyzyWnpYlp root@melody
command="/home/pi/pilog meridian" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDXYAEJ3+7nlfwWYFC5Wn/jBRkxGUIVOwK9DnCvXHc6It2h2AIm5ekXbotCY6W7arux1MAghFr7VB0kXBMs2jI7wPBK2p4iF7F9tcXMCDq504HoIToCXo3YmaOt0U+KzSY52Sik37chTbbZoi0jkpZz4fVUXtcEmSRvg4Gz1FaruBq3OWWJNnv5VYHEIgaIt/OFwcIWfk1ryHTepYzvL22/OnlEzsPk1a7MOfWiF+fEC7ZSjaXG/m4Qkh8ziBN0jcsg4gql7To4F+DS42N77zFXE3X05JAXpZlPKJexa6kDsYOBErDb4rFcjhktMLzgHz+a4wnMpSQb+Lhuwu/hUZkV root@meridian
command="/home/pi/pilog X1C3" ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAvdX/Ta6zdZF/qsdXjbL3WFk5hmxiwkZEdwmhGe8uryICWppfjEQaATjhkklBBYHPSsjHuJ9G+7DHRH78Dpb02WMrq8h8nXG+wG49lwGpG+QF2Lu+738Rj3Yci3j6O6eXnEkOLnwKeqwYeZFuMP+m6vywLFQxeJ3O5wiP5A+mZXk5fytJM826IZnmidSTIjB7mN7qfD67ELF9QbrEA7RrdD596q2efw0TvYXHDIoQAReaVNyOKPqXSTZ1k2ShWiO/Q83DoZKBNhN3OAkevLWZjZKbMgLYgJmLmkkvcyLaBsYbpwX/mSEMsnM1FslNrDEo2VsARYIJF523BOq2/MU3OQ== hendry@x61
command="/home/pi/pilog uptown" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDWnbt819Ynj2XB2HDZME5QS0RkWFlGPivJ5AHcEliU7sIbbvXIJ7rt7WJs07M1GoQ/B5UnbHCaEVInKRLtJAidT69vS7wNeTI32KRxCHOW5QVNOYzP7TobT2x9vwYEMCslE8VrtBz/WpKfFIJrAxygqKKN0Y9C7DOUUx1/4l3XsLpgRDEpnZeM0IQJBHn9/X3bgZuPpzL9VKOXkh5AL1cXReJYOOGBO/F3bRq3n2hCvN8sDz4ISwgWstjdEP8FFHwtOXbWGAOE84zcUMkP5do7PKfKg6jMJVTNR6MwOPeLog9xzP2VcnBK+Jf8osbQ4YBdeyA2ao3ZbdHtAPHO5q// root@alarmpi
command="/home/pi/pilog latitude" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCqVsz/8DNsDb9VqxNbdBoctHCDQqmfTycjElR8/0hQ/CkECFBDikpZ/1zHlzjDatVBxxSgjO+CnsylgD26DQuR3G/BPJFLNIyF8zYg1YZPka7kwGrsma4M7hoy0ISJ2GkuRD0g/1Bk42A9L6SfsuPiMtaXWjnPnw654YP1/40cPjKBNhiggObeIlDlXBEerhdQHHc6DYrzV/rx0/Bn3Hu4M78Q2+UDvNM9H64q1KAVCkEf7CA7juK1B6ZOXTqZGWlBZ8xE8OvvaR58u6HM2B5E8oHpo84zrkD4HcfqyMUuxNSbFyXg4r3m7eWOmS8J7roYwg6R5Jd+tRbqGNZPZcW7 root@latitude
command="/home/pi/pilog dave" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDE/geIV0IDBcT80dL90AJ0DuADVfHejsaxqHSZ9/6J07tEbD1UAj0nA+WeXFOSNEPpduqQgDPAvc0wjEimrz2ggXpc8MCXS/QFsYtZxYdPKGdu51a/GEhecYOy2Tafgfhty8AJdtFHBrghzItvXw0NVYbkMPzkahGm3AzWfmDAxpHDJ7YxXizW8kf1wlTbObvmPj00cIxjqgUnk14j6gjoxElzG9DiPUETyKIjRwCetqP6WssA9Yc3eEpMDpYUR+xMuPadvQ7GtRtvg0WY3pbjWtlAtHlpeThqqVV9lDBKYKI5bjxZUya2uU8fXQeLRF8FTmS6VGL+ofQQw9PWOfrX root@sound
command="/home/pi/pilog hall" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCjbYkjIN80OPurhn0np+dzT9vmprsfdNPsQvHuRBJHpTSPn1pCEXn34Rp8A9GU69yudOhp7kSpKXLfz2HxLT2G2/bDuRDBXsFlgwJdpx6x3mnSkV4xCSYXf1EEvWmnSDtnL2yQ5U5VCf96Xg6J0aoDQDIqop3+dtYHcNPXNXTtRmKYAJ5sLkzlbtdtmQW6hPovHbvX5ejChSVoLsyyaEbCqPLsdDdPlD9CkpRwlWq1g2DYh/Bs3OeoRdwTZnjwg+U+WNTql5aXHoNgwhmKWBqBVi5/4+4rEoFGhe1Cvy21LGmlexUTXt5DFyPxe8xn1sAHkywWttCRBfH6XZtq49m/ root@hall
command="/home/pi/pilog alice" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDsYMMZbabA/Gd4cAyvsTdJdne9nSatT25Uvff3LJPwWVGlyFWu9NeHkJQLBg2YmR4a9GB8Tic/Ud5In/tuQmlgNnTJX297jQd69/2X3C+s2UnDEq71ssVysYKDM3Mb+zAaYjsqhr0gZNQA5H4kBq8gGhZMNR3gAlYdB2oR99TS69KzrbZEhfY5REM82Y9uCL/xDMjxdcCLAp92NMMSyyhx4s2rGDotaomFN3PUogl0smeSMmCwVdYl3ZlcOXZklsa1eTy3Yi38g0iy5jtrdvh/IeV3ajViKSzO2c/NH2crTwRWTHdo8gnrfus4mnj67r4iwGcj8FCMnNgG0DuPOGel root@alice
command="/home/pi/pilog proxy-test" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCnzLkJlpT+wxYNDfF/cI7VNktb4esWhNLJL3Fawq9EaMNFJTgf7DQ4r/595xxJXOrfs9S2+xX4Db4EJzYePXG7jyVH86m9WpfS2EEkkWlLjYGoVJejJ1AAE/Bb9NEYPQpL1Kvs7pTSdRIVPESdm95bdLo5nNg1HlCcvbDw6pYTrdnR2faB3gXkZdbdWR05zfoM8N4FmJgo8eZWJpAB2PrwfvSW7dRrWxmG0SUNBOBMjwW68aBCaXFoLm8DaMKTd+Ct/W8jR/5lHRdYkgiaChfiDsBJWeVfTr3d/qU7WCdvd2BwxxHzMXFVArwF27WdsiY2lUR2svRqFn3VT+iLwoK7 spuul1
command="/home/pi/pilog pickfire" ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMk3lBWVlCpqNlxolPLyAz/Wzf9/Wd7D9GvfLymG3chx root@rpi

$ cat /home/pi/pilog
#!/bin/bash

pi=/srv/www/pi.dabase.com/$1/$(date -u +%j).csv
mkdir -p $(dirname $pi)
trap "echo 0 $(date +%s) >> $pi" EXIT
echo 1 $(date +%s) $SSH_ORIGINAL_COMMAND $SSH_CONNECTION >> $pi
ln -sf $pi $(dirname $pi)/index.txt

# Keep the command= connection open till it's closed and then the trap will fire
cat > /dev/null

Tweaks to /etc/ssh/sshd_config to make it work:


GatewayPorts yes
TCPKeepAlive yes
ClientAliveInterval 10

For more PI tricks and tips.