System Administration: March 2008 Archives
我们用daemontools来控制ssh tunnel确保tunnel能在意外断开后主动连接上。在daemon中做tunnel最大的问题就是如何输入密码。这个问题可以使用以前的 ssh-attach 脚本来解决。
首先创建一个连接脚本(tunnel.sh):
#!/bin/sh
HOME=/home/jianingy
eval `$HOME/bin/ssh-attach`
ssh -p 23456 -b 0.0.0.0 -R 12345:localhost:143 xxx.xxx.xxx.xxx "vmstat 60"
再建立daemontools的run脚本:
#!/bin/sh
exec setuidgid jianingy ./tunnel.sh
用加载ssh-agent的用户(这里是jianingy)来执行tunnel.sh(即用setuidgid jianingy在指定),酱紫tunnel.sh中调用的ssh-attach便能复用已有的ssh-agent了,保证tunnel连接无须输入密码.
Search
October 2008
Friends
Recent Posts
Tag Cloud
- acm
- algorithm
- apache
- bash
- basketball
- bitlbee
- blog
- book
- boot
- camera
- cnlexizer
- computer vision
- console
- daemon
- daemontools
- debian
- directx
- dll
- dotNet
- dynamic programming
- eating
- eduos
- embedded
- evc
- eye candy
- fastcgi
- firefox
- framebuffer
- freebsd
- fs
- git
- grep
- hardware
- ifconfig
- im
- inputrc
- json
- kernel
- life
- linux
- maintainance
- math
- moluser
- msmtp
- mutt
- network
- nfs
- nlp
- notebook
- patch
- performance
- perl
- php
- printf
- regex
- router
- rxvt-unicode
- scp
- screen
- sexy
- shell
- slackware
- smartphone
- ssh
- ssl
- svn
- sysrq
- toshiba
- tunnel
- urxvt
- vc
- vcs
- vfw
- wallpaper
- windows
- xargs
Categories
Powered by Movable Type
Recent Comments
FW on 【转】rxvt-unicode (urxvt) 字间距过宽的patch: pls contac
jianingy on 用正则表达式Look-Ahead做带逃逸的变量替换: 这个lc是啥意思?
cnhackTNT on 用正则表达式Look-Ahead做带逃逸的变量替换: 晕,被过滤掉了,再试
cnhackTNT on 用正则表达式Look-Ahead做带逃逸的变量替换: s/(? 这样可以
R.Q. on 个性化SSH登录: 酱紫哦,了了 ---