Imoutable Infrastructure

早速作りました。

Ubuntu 12.04 LTS で動作確認しました。Ubuntu じゃないと動かないと思います。

# aptitude install update-motd
# rm -f /etc/update-motd.d/*
# vi /etc/update-motd.d/99-imoutable
(後述)

# grep UsePAM /etc/ssh/sshd_config
UsePAM yes
(UsePAM yesじゃなかったらyesにして service ssh restart)

# grep motd /etc/pam.d/sshd
session    optional     pam_motd.so # [1]
(pam_motdがコメントアウトされていたらコメントを外す)

動作例


/etc/update-motd.d/99-imoutable

#!/bin/bash

imouto=(
  'こんにちは!お兄ちゃん!!'
  '久しぶりだね!さびしかったよ。。'
)

nmesg=${#imouto[@]}

idx=$(($RANDOM % $nmesg))
echo
echo ${imouto[$idx]}
echo