[[PageOutline]] * known_hostsから特定のhostのフィンガープリントを削除 * ssh-keygen -R "hostname" * [http://d.hatena.ne.jp/m19cmjigen/20110309 ssh-keyscanによるknown_hostsの更新 - へたれのへたれの為のへたれ記] > * # ログイン用サーバーのリストの作成 > * $vim server.txt > {{{ > server1 > server2 > server3 > ・・・ > }}} > * #フィンガープリントの作成とknown_hostsへの書き込み > * $bash -c "ssh-keyscan -f servers.txt" >> ~/.ssh/known_hosts * [http://sugi.nemui.org/diary/20100410.html#p02 |linux| autossh + daemontools で ssh トンネルを維持する - TPRG: memo (2010-04-10)] * via [http://d.hatena.ne.jp/naba_san/20110425/1303747690 SSHの自動接続サービス (ポート転送とか) - なば日記@不完全なマシマロ] * [http://serverfault.com/questions/53080/how-to-enable-ssh-x11-forwarding-through-additional-server linux - How to enable SSH X11 forwarding through additional server? - Server Fault] >> I have hosts A,B and C. From host A I can access through ssh only B. From B I can access C. I want to be able to run X11 programs on C and forward display to A. > not exactly... if X11Forwarding is not enabled on server C, it won't work. it also won't work unless one sets AllowTcpForwarding yes and GatewayPorts yes on server B. this answer is not acceptable at all * [http://ngyuki.hatenablog.com/entry/20120508/p1 SSHのエージェントフォワーディングを「sudo」の後でも引き継ぐ - ngの日記] > {{{sudo SSH_AUTH_SOCK=$SSH_AUTH_SOCK rsync -av remotehost:/path/ /path/}}} * [http://www.gcd.org/blog/2006/09/100/ 仙石浩明の日記: ssh-agent を screen の中から使う方法] > {{{#!sh > agent="$HOME/tmp/ssh-agent-$USER" > if [ -S "$SSH_AUTH_SOCK" ]; then > case $SSH_AUTH_SOCK in > /tmp/*/agent.[0-9]*) > ln -snf "$SSH_AUTH_SOCK" $agent && export SSH_AUTH_SOCK=$agent > esac > elif [ -S $agent ]; then > export SSH_AUTH_SOCK=$agent > else > echo "no ssh-agent" > fi > }}} = X11Forwarding with another user = * [http://www.diederickdevries.net/blog/2010/06/05/x-forwarding-and-sudo/ My Cup of Tea / X Forwarding and sudo] > The reason for this is that: > X authentication is based on cookies — secret little pieces of random data that only you and the X server know… So, you need to let the other user in on what your cookie is (http://www.debian-administration.org/articles/494). > > {{{ > me@localbox:~$ ssh -X remotebox > me@remotebox:~$ chmod 644 .Xauthority > me@remotebox:~$ su - otheruser > Password: > otheruser@remotebox:~$ export DISPLAY=localhost:10.0 > otheruser@remotebox:~$ export XAUTHORITY=/home/me/.Xauthority > }}} * sudo する場合は「chmod 644 .Xauthority」は必要ない(rootからは必ず読めるため) * [http://serverfault.com/questions/51005/how-to-use-xauth-to-run-graphical-application-via-other-user-on-linux sudo - how to use xauth to run graphical application via other user on linux - Server Fault] > sudo apt-get install sux = disable certain users to login with ssh = * [http://www.atmarkit.co.jp/flinux/rensai/linuxtips/739pamssh.html @IT:sshの利用をユーザー単位で許可/不許可するには] * /etc/pam.d/sshd {{{#!diff @@ -15,7 +15,7 @@ # Uncomment and edit /etc/security/access.conf if you need to set complex # access limits that are hard to express in sshd_config. -# account required pam_access.so +account required pam_access.so # Standard Un*x authorization. @include common-account }}} * /etc/security/access.conf {{{ -:USERNAME:ALL }}} * [http://kazmax.zpp.jp/linux/lin_pam.html ssh を、ユーザ、IPでアクセス制限] * [http://d.hatena.ne.jp/hogem/20100906/1283789476 pam + opensshでユーザごとのログインIP制限 - うまい棒blog] = avoid sshd brute force = * [http://dora.bk.tsukuba.ac.jp/~takeuchi/index.php?%B4%C9%CD%FD%BC%D4%2Fsshd%20%A4%D8%A4%CE%B9%B6%B7%E2%A4%F2%B7%E2%C2%E0 管理者/sshd への攻撃を撃退 - takeuchi@ShigekawaLab] * [http://dsas.blog.klab.org/archives/50208645.html DSAS開発者の部屋:ssh の brute force アタックパケットの制限 -- DOS 的パケットをフィルタリングする] * 対象はSSHdだが、ポートを変えるだけで他のサービスにも応用できそう * [http://slashdot.jp/linux/comments.pl?sid=401869&cid=1345065 コメント: Debianのopensslパッケージに欠陥発覚 - スラッシュドット・ジャパン] {{{ iptables というか Netfilter で tcp/22 への SYN はゆっくりしか受け取れない 設定をしていたので,総当たりするとなると何日もかかると思うんだよな・・ }}} * [http://kaworu.jpn.org/kaworu/2008-02-20-1.php sshブルートフォースアタックを防ぐiptablesを使ったblocksshd] = Cluster SSH = * [http://blog.livedoor.jp/hakin/archives/51564707.html しげふみメモ : Cluster SSHで複数ホストでコマンド同時実行]