メールを受信するサーバにメール受信用ユーザを登録する。 受信するメールアドレスは[ユーザ名]@ホスト名になります。 # adduser [ユーザ名] # passwd [パスワード] .forwardに転送設定を記述 /home/[ユーザ名]/.forward register,”| /usr/bin/php /path/to/autoreply.php .転送先はphpスクリプト。パイプでメール内容を渡している。 autoreply.php(返信処理の内容)はこんなふうになる。 [sourcecode language='php'] require_once(“Mail/mimeDecode.php”); //REARモジュール //メールソースを標準入力から読み込み $source = file_get_contents(“php://stdin”); if(!$source) { return false; // 読み込み失敗 } //メール解析 $params['include_bodies'] = true; $params['decode_bodies'] = true; $params['decode_headers'] = true; $decoder = new Mail_mimeDecode($source); $structure = $decoder->decode($params); // 送信者のメールアドレスを取得する $from_address = mb_convert_encoding(mb_decode_mimeheader($structure->headers['from']) ,mb_internal_encoding(), “auto”); [/sourcecode] [...]
Archive for 4月, 2009
Linux:ssh公開鍵認証
4月 12th, 2009
admin ローカルサーバ(接続元)からリモートサーバ(接続先)にパスワード無しでログインする設定。 以下ローカルサーバのfooユーザがリモートサーバにbarユーザでログインする場合。 ローカルサーバ(接続元)で認証キーを作る # ssh-keygen -t rsa -N “” -f /home/foo/.ssh/authkey_bar rsync.pub (公開鍵)をリモートサーバ(接続先)の/bar/.sshにコピーするローカルサーバからSCPで転送 # scp authkey_bar.pub bar@リモートサーバ:/tmp この時点ではまだパスワードを聞かれるので入力する。 リモートサーバにbarでログインして/home/bar/.sshに移動し、パーミッション変更&authorized_keysに追記 authorized_keysのパーミッションは必ず600でなくてはいけない。644ではパスワードを聞かれます。 # chmod 700 /home/bar/.ssh # mv /tmp/rsync.pub /home/bar/.ssh # cat /home/bar/.ssh/authkey_bar.pub >> /root/.ssh/authorized_keys # chmod 600 /home/bar/.ssh/authorized_keys # rm /home/bar/.ssh/authkey_bar.pub
Linux:ソースからインストール&パッケージ作成
4月 11th, 2009
admin checkinstallなるものでソースからインストールしつつパッケージを作成できるらしいので試してみた。 まずはcheckinstallをインストールする。 wget http://asic-linux.com.mx/~izto/checkinstall/files/rpm/checkinstall-1.6.1-1.i386.rpm rpm -ihv checkinstall-1.6.1 どこに入ったかわからなくなったので・・・^^; rpm -ql checkinstall どうやら/usr/local/sbin/checkinstall -h でヘルプ表示 /usr/local/sbin/checkinstall -h checkinstall 1.6.1, Copyright 2002 Felipe Eduardo Sanchez Diaz Duran This software is released under the GNU GPL. Usage: checkinstall [options] [command [command arguments]] Options: *Package type selection* -t,–type= Choose packaging system -S Build a Slackware package -R Build a [...]
Windows Vista:右クリックで送る(Send To)の登録方法
4月 11th, 2009
admin SendToフォルダにショートカットを置くとそのアプリに「右クリック→送る」の動作でファイルを渡せます。 VistaはSendToフォルダの場所がわかりにくい・・・。 C:Usersユーザ名AppDataRoamingMicrosoftWindowsSendTo

Posted in
Tags: