<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ソメログ &#187; coreserver</title>
	<atom:link href="http://s.arw.cc/tag/coreserver/feed" rel="self" type="application/rss+xml" />
	<link>http://s.arw.cc</link>
	<description>昔のあだ名はマイコンだった。</description>
	<lastBuildDate>Sat, 04 Feb 2012 22:04:44 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Coreserverのssh登録を自動化する -その２-</title>
		<link>http://s.arw.cc/2009/03/11/log:66/coreserver%e3%81%aessh%e7%99%bb%e9%8c%b2%e3%82%92%e8%87%aa%e5%8b%95%e5%8c%96%e3%81%99%e3%82%8b-%e3%81%9d%e3%81%ae%ef%bc%92</link>
		<comments>http://s.arw.cc/2009/03/11/log:66/coreserver%e3%81%aessh%e7%99%bb%e9%8c%b2%e3%82%92%e8%87%aa%e5%8b%95%e5%8c%96%e3%81%99%e3%82%8b-%e3%81%9d%e3%81%ae%ef%bc%92#comments</comments>
		<pubDate>Tue, 10 Mar 2009 15:59:03 +0000</pubDate>
		<dc:creator>some</dc:creator>
				<category><![CDATA[記事]]></category>
		<category><![CDATA[coreserver]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://s.arw.cc/2009/03/11/log:66/coreserver%e3%81%aessh%e7%99%bb%e9%8c%b2%e3%82%92%e8%87%aa%e5%8b%95%e5%8c%96%e3%81%99%e3%82%8b-%e3%81%9d%e3%81%ae%ef%bc%92</guid>
		<description><![CDATA[前回からの続きです。今回は公開鍵でパスワード入力の手間を省きます。 前回、便利スクリプトのおかげで簡単にホスト登録ができるようになった。Coreserverのホスト登録が反映されればターミナルからsshで接続できるようになる。例えばs0.coreserver.jpにユーザ名exampleで接続するには、ターミナルから ssh example@s0.coreserver.jp と入力してリターン。パスワードを求められるので入力すればログイン、という流れ。パスワードを毎回入力するのは面倒なので、公開鍵を作ってパスワード入力の手間を省きます。 [Mac上での作業] まずは鍵のペアを作成する。ターミナルから ssh-keygen を実行。 Enter file in which to save the key (/Users/[ユーザ名]/.ssh/id_rsa): と聞かれるがそのままリターン。次にパスワードを聞かれるので任意で入力。パスワードを付けないなら何も入力せずにリターン。 これで/Users/[ユーザ名]/.ssh/に id_rsa id_rsa.pub という２つのファイルができる。 [Coreserverでの作業] この作業はFTPクライアントからでもいいし、ターミナルからsshで作業してもいい。 ・FTPクライアントでの手順 自分のアカウントでCoreserverにログインしたらルート階層に.sshフォルダを作成する。そのフォルダの中に「authorized_keys」というファイルを作成し、Mac上で作成したid_rsa.pubの中身をコピペする。authorized_keysファイルの最後の行に空の改行を１行入れておくのを忘れないように。Coreserverでの作業はこれだけ。 ・ターミナルを使用する手順 sshで接続したら、 mkdir .ssh chmod 700 .ssh cd .ssh touch authorized_keys ここで.sshディレクトリにMac上で作成したid_rsa.pubを転送しておいて、 cat &#8230; <a href="http://s.arw.cc/2009/03/11/log:66/coreserver%e3%81%aessh%e7%99%bb%e9%8c%b2%e3%82%92%e8%87%aa%e5%8b%95%e5%8c%96%e3%81%99%e3%82%8b-%e3%81%9d%e3%81%ae%ef%bc%92">Continue reading <span class="meta-nav">&#8594;</span></a><div class="addthis_toolbox addthis_default_style " addthis:url='http://s.arw.cc/2009/03/11/log:66/coreserver%e3%81%aessh%e7%99%bb%e9%8c%b2%e3%82%92%e8%87%aa%e5%8b%95%e5%8c%96%e3%81%99%e3%82%8b-%e3%81%9d%e3%81%ae%ef%bc%92' addthis:title='Coreserverのssh登録を自動化する -その２- '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_button_google_plusone" g:plusone:size="medium"></a><a class="addthis_counter addthis_pill_style"></a></div>]]></description>
			<content:encoded><![CDATA[<p><a href="http://s.arw.cc/2009/03/10/log:63/coreserver%e3%81%aessh%e7%99%bb%e9%8c%b2%e3%82%92%e8%87%aa%e5%8b%95%e5%8c%96%e3%81%99%e3%82%8b">前回からの続き</a>です。今回は公開鍵でパスワード入力の手間を省きます。</p>
<p>前回、便利スクリプトのおかげで簡単にホスト登録ができるようになった。Coreserverのホスト登録が反映されればターミナルからsshで接続できるようになる。例えばs0.coreserver.jpにユーザ名exampleで接続するには、ターミナルから</p>
<pre lang="bash">ssh example@s0.coreserver.jp</pre>
<p>と入力してリターン。パスワードを求められるので入力すればログイン、という流れ。パスワードを毎回入力するのは面倒なので、公開鍵を作ってパスワード入力の手間を省きます。<br />
<span id="more-66"></span><br />
[Mac上での作業]<br />
まずは鍵のペアを作成する。ターミナルから</p>
<pre lang="bash">ssh-keygen</pre>
<p>を実行。</p>
<pre lang="bash">Enter file in which to save the key (/Users/[ユーザ名]/.ssh/id_rsa):</pre>
<p>と聞かれるがそのままリターン。次にパスワードを聞かれるので任意で入力。パスワードを付けないなら何も入力せずにリターン。<br />
これで/Users/[ユーザ名]/.ssh/に<br />
id_rsa<br />
id_rsa.pub<br />
という２つのファイルができる。</p>
<p>[Coreserverでの作業]<br />
この作業はFTPクライアントからでもいいし、ターミナルからsshで作業してもいい。</p>
<p>・FTPクライアントでの手順<br />
自分のアカウントでCoreserverにログインしたらルート階層に.sshフォルダを作成する。そのフォルダの中に「authorized_keys」というファイルを作成し、Mac上で作成したid_rsa.pubの中身をコピペする。authorized_keysファイルの最後の行に空の改行を１行入れておくのを忘れないように。Coreserverでの作業はこれだけ。</p>
<p>・ターミナルを使用する手順<br />
sshで接続したら、</p>
<pre lang="bash">mkdir .ssh
chmod 700 .ssh
cd .ssh
touch authorized_keys</pre>
<p>ここで.sshディレクトリにMac上で作成したid_rsa.pubを転送しておいて、</p>
<pre lang="bash">cat id_dsa.pub >> authorized_keys</pre>
<p>とすることでauthorized_keysにid_dsa.pubの内容を追加できる。Coreserverでの作業はこれだけ。</p>
<p>mvコマンドでid_dsa.pubをauthorized_keysにリネームしてもいいんだけど、複数の鍵をauthorized_keysに追加したいときはcatコマンドの方がいいのかなーと思ってます。</p>
<p>これにて公開鍵の設定は完了。今後Coreserverにssh接続する時は</p>
<pre lang="bash">ssh example@s0.coreserver.jp</pre>
<p>とするだけでパスワードの入力無しで接続できるようになった。</p>
<p>僕は.bash_profileに</p>
<pre lang="bash">alias sc='ssh example@s0.coreserver.jp'</pre>
<p>を登録しているのでターミナルからscって入力するだけでssh接続できるようになってます。<br />
ちょっと便利。</p>
<p>これでCoreserverへの自動登録と簡単ssh接続が実現できた。あとはCronで定期的にスクリプトを実行して常に登録状態にしておくとかすれば便利なのかも知れないけど、それってマナー的にどうなんでしょうか。例えば10分毎に登録しに行くとして、1時間に6回、1日144回登録しに行ってしまうわけね。<br />
理想としては自分のホスト名が変更された事をトリガーとしてPHPスクリプトを実行させたい。それなら必要最低限の登録ですむからね。</p>
<p>というわけで次回、ホスト情報変更の取得によるPHP実行に続く・・・かも知れない。</p>
<div class="addthis_toolbox addthis_default_style " addthis:url='http://s.arw.cc/2009/03/11/log:66/coreserver%e3%81%aessh%e7%99%bb%e9%8c%b2%e3%82%92%e8%87%aa%e5%8b%95%e5%8c%96%e3%81%99%e3%82%8b-%e3%81%9d%e3%81%ae%ef%bc%92' addthis:title='Coreserverのssh登録を自動化する -その２- '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_button_google_plusone" g:plusone:size="medium"></a><a class="addthis_counter addthis_pill_style"></a></div>]]></content:encoded>
			<wfw:commentRss>http://s.arw.cc/2009/03/11/log:66/coreserver%e3%81%aessh%e7%99%bb%e9%8c%b2%e3%82%92%e8%87%aa%e5%8b%95%e5%8c%96%e3%81%99%e3%82%8b-%e3%81%9d%e3%81%ae%ef%bc%92/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Coreserverのssh登録を自動化する</title>
		<link>http://s.arw.cc/2009/03/10/log:63/coreserver%e3%81%aessh%e7%99%bb%e9%8c%b2%e3%82%92%e8%87%aa%e5%8b%95%e5%8c%96%e3%81%99%e3%82%8b</link>
		<comments>http://s.arw.cc/2009/03/10/log:63/coreserver%e3%81%aessh%e7%99%bb%e9%8c%b2%e3%82%92%e8%87%aa%e5%8b%95%e5%8c%96%e3%81%99%e3%82%8b#comments</comments>
		<pubDate>Mon, 09 Mar 2009 15:34:17 +0000</pubDate>
		<dc:creator>some</dc:creator>
				<category><![CDATA[記事]]></category>
		<category><![CDATA[coreserver]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://s.arw.cc/2009/03/10/log:63/coreserver%e3%81%aessh%e7%99%bb%e9%8c%b2%e3%82%92%e8%87%aa%e5%8b%95%e5%8c%96%e3%81%99%e3%82%8b-2/</guid>
		<description><![CDATA[Coreserverでsshを利用するには、その都度ホスト登録が必要なんだけど、これって結構面倒なんだよね・・・。なのでスクリプトで更新できればな～と思いググってみたら希望通りのものがありました！ [From Coreserver(XREAも?)のssh登録が面倒なので - WebProgを極めて居酒屋を開発する] ↑こちらで公開されているPHPスクリプトをCoreserverUtil.phpという名前で保存する。そして以下の３行を自分の環境に合わせて変更する。 Rhaco::constant('USERNAME', 'userid'); Rhaco::constant('PASSWORD', 'pass'); Rhaco::constant('SERVER', 's13.coreserver.jp'); また、このスクリプトではRhacoというフレームワークが使用されているのでそれもダウンロードしておく。ディレクトリ構成はこんな感じにしてみた。 /Users/[ユーザID]/Util/ ├─CoreserverUtil.php └─rhaco └─Rhaco.php（およびその他のファイル） あとはターミナルから php ~/Util/CoreserverUtil.php とすれば何分か後にはsshが利用できるようになる。 素敵なスクリプトを公開してくださってありがとうございます！！ 後はcronと公開鍵の設定をすればもっと便利になるはず。それはまた次回・・・。 [2009.3.11追記] Coreserverのssh登録を自動化する -その２-に続きます。<div class="addthis_toolbox addthis_default_style " addthis:url='http://s.arw.cc/2009/03/10/log:63/coreserver%e3%81%aessh%e7%99%bb%e9%8c%b2%e3%82%92%e8%87%aa%e5%8b%95%e5%8c%96%e3%81%99%e3%82%8b' addthis:title='Coreserverのssh登録を自動化する '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_button_google_plusone" g:plusone:size="medium"></a><a class="addthis_counter addthis_pill_style"></a></div>]]></description>
			<content:encoded><![CDATA[<p>Coreserverでsshを利用するには、その都度ホスト登録が必要なんだけど、これって結構面倒なんだよね・・・。なのでスクリプトで更新できればな～と思いググってみたら希望通りのものがありました！</p>
<blockquote cite="http://d.hatena.ne.jp/riaf/20080901/1220251618"><p>
  [From <a href="http://d.hatena.ne.jp/riaf/20080901/1220251618"><cite>Coreserver(XREAも?)のssh登録が面倒なので - WebProgを極めて居酒屋を開発する</cite></a>]
</p></blockquote>
<p>↑こちらで公開されているPHPスクリプトをCoreserverUtil.phpという名前で保存する。そして以下の３行を自分の環境に合わせて変更する。</p>
<pre lang='php'>
Rhaco::constant('USERNAME', 'userid');
Rhaco::constant('PASSWORD', 'pass');
Rhaco::constant('SERVER', 's13.coreserver.jp');
</pre>
<p>また、このスクリプトでは<a href="http://rhaco.org/">Rhaco</a>というフレームワークが使用されているのでそれもダウンロードしておく。ディレクトリ構成はこんな感じにしてみた。</p>
<p>/Users/[ユーザID]/Util/<br />
├─CoreserverUtil.php<br />
└─rhaco<br />
    └─Rhaco.php（およびその他のファイル）</p>
<p>あとはターミナルから</p>
<pre lang='bash'>php ~/Util/CoreserverUtil.php</pre>
<p>とすれば何分か後にはsshが利用できるようになる。</p>
<p>素敵なスクリプトを公開してくださってありがとうございます！！</p>
<p>後はcronと公開鍵の設定をすればもっと便利になるはず。それはまた次回・・・。</p>
<p>[2009.3.11追記]<br />
<a href="http://s.arw.cc/2009/03/11/log:66/coreserver%e3%81%aessh%e7%99%bb%e9%8c%b2%e3%82%92%e8%87%aa%e5%8b%95%e5%8c%96%e3%81%99%e3%82%8b-%e3%81%9d%e3%81%ae%ef%bc%92">Coreserverのssh登録を自動化する -その２-</a>に続きます。</p>
<div class="addthis_toolbox addthis_default_style " addthis:url='http://s.arw.cc/2009/03/10/log:63/coreserver%e3%81%aessh%e7%99%bb%e9%8c%b2%e3%82%92%e8%87%aa%e5%8b%95%e5%8c%96%e3%81%99%e3%82%8b' addthis:title='Coreserverのssh登録を自動化する '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_button_google_plusone" g:plusone:size="medium"></a><a class="addthis_counter addthis_pill_style"></a></div>]]></content:encoded>
			<wfw:commentRss>http://s.arw.cc/2009/03/10/log:63/coreserver%e3%81%aessh%e7%99%bb%e9%8c%b2%e3%82%92%e8%87%aa%e5%8b%95%e5%8c%96%e3%81%99%e3%82%8b/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic (Feed is rejected)
Page Caching using disk: enhanced
Database Caching 1/13 queries in 0.153 seconds using disk: basic
Object Caching 370/390 objects using disk: basic

Served from: s.arw.cc @ 2012-02-06 20:06:54 -->
