<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Ssh on 答えを知りたい</title><link>https://hack.ironsand.net/tags/ssh/</link><description>Recent content in Ssh on 答えを知りたい</description><generator>Hugo -- 0.147.9</generator><language>en-US</language><lastBuildDate>Mon, 29 Jul 2019 00:00:00 +0000</lastBuildDate><atom:link href="https://hack.ironsand.net/tags/ssh/index.xml" rel="self" type="application/rss+xml"/><item><title>Githubから公開鍵を取ってきてSSHを設定するItamaeレシピ</title><link>https://hack.ironsand.net/2019/configure-ssh-by-itamae-recipe-with-github-registered-public-key/</link><pubDate>Mon, 29 Jul 2019 00:00:00 +0000</pubDate><guid>https://hack.ironsand.net/2019/configure-ssh-by-itamae-recipe-with-github-registered-public-key/</guid><description>&lt;p>VPSを借りたときにまずリモートから作業するためにSSHキーの配置とかをやるItamaeのレシピを書きました。
ローカルのユーザー名とGithubのアカウント名が同一なのが条件なので別ユーザー名で使いたい場合は適宜書き換えてください。&lt;/p></description></item><item><title>screenを使ってssh経由のコマンドを便利に</title><link>https://hack.ironsand.net/2014/screen-make-ssh-commands-handy/</link><pubDate>Wed, 30 Apr 2014 21:23:03 +0000</pubDate><guid>https://hack.ironsand.net/2014/screen-make-ssh-commands-handy/</guid><description>&lt;p>&lt;code>ssh&lt;/code>でログインして処理の重たいコマンドを実行した後にセッションが途切れてしまうとそのコマンドをもう一度&lt;code>fb&lt;/code>などでフォアグラウンドに持ってこようと思っても残念ながらできません。違うシェルのインスタンスから立ち上げたらプロセスは別のインスタンスのシェルには持ってこれないかららしいです。&lt;/p>
&lt;h3 id="screenの使い方">Screenの使い方&lt;/h3>
&lt;p>まず初めからコマンドを&lt;code>screen&lt;/code>を使って立ち上げておきましょう。&lt;/p>
&lt;p>&lt;code>$ screen ruby it_takes_very_long.rb&lt;/code>&lt;/p>
&lt;p>そして、一旦&lt;code>ssh&lt;/code>の接続を切って繋ぎ直します。&lt;/p>
&lt;p>&lt;code>$ screen -list&lt;/code>をするとこんな感じで表示されるので&lt;/p>
&lt;pre>&lt;code>There is a screen on:
31744.pts-0.Sakura (Detached)
1 Socket in /var/run/screen/S-ironsand.
&lt;/code>&lt;/pre>
&lt;p>&lt;code>$ screen -r 31744.pts-0.Sakura&lt;/code>でスクリーンに繋ぎ直せば画面への出力をもう一度見ることが出来ます。&lt;/p>
&lt;h3 id="参考">参考&lt;/h3>
&lt;p>[Linux Screen Tutorial – YouTube][1]&lt;/p></description></item><item><title>cygwinの必要なパッケージをコマンドラインで一括インストール</title><link>https://hack.ironsand.net/2014/install-cygwin-package-by-using-command-line/</link><pubDate>Mon, 14 Apr 2014 19:55:58 +0000</pubDate><guid>https://hack.ironsand.net/2014/install-cygwin-package-by-using-command-line/</guid><description>&lt;p>今まではcygwinをインストールしたディレクトリを全部SugarSyncで同期して使ってたんだけど、&lt;/p>
&lt;p>よくわからないままに色々入れてたら700MBぐらいあったので整理整頓することにしました。&lt;/p>
&lt;h3 id="どうするか">どうするか？&lt;/h3>
&lt;p>既にインストールされてるcygwinのファイルを整理するのはめんどくさかったの新規インストールをすることにしたのはいいけど、何せパッケージ選択がめんどくさい。めんどくさいっていうか手動でやると必ず忘れてしまうので自動化したい。&lt;/p>
&lt;p>そこでコマンドラインインストールの登場です！&lt;/p>
&lt;h3 id="インストール方法">インストール方法&lt;/h3>
&lt;pre>&lt;code>setup-x86.exe --quiet-mode -P util-linux,curl,wget,openssh,rsync,zip,tree -s ftp://ftp.iij.ad.jp/pub/cygwin/ --root %USERPROFILE%\cyg --local-package-dir %USERPROFILE%\cyg
&lt;/code>&lt;/pre>
&lt;p>これでホームディレクトリ直下の &lt;code>C:\Users\ironsand\cyg&lt;/code>とかにインストールされる。&lt;/p>
&lt;h3 id="やめたパッケージ">やめたパッケージ&lt;/h3>
&lt;p>&lt;code>gcc&lt;/code>とか入れてcygwinでコンパイルして色々してると毎回ドツボにハマるので、もうそういうのはVirtualBox上のUbuntuですることにする。&lt;/p>
&lt;p>&lt;code>ruby&lt;/code>や&lt;code>python&lt;/code>はWindowsのネイティブパッケージを使う。結局なんだかんだでそれが一番安定してる気がするので。&lt;/p>
&lt;p>&lt;code>git&lt;/code>も&lt;code>cygwin&lt;/code>用のパス名周りのエラーが鬱陶しくなることがちょくちょくあったので&lt;code>Chocolatey&lt;/code>使って&lt;code>cinst git&lt;/code>でインストールする方法に変更。&lt;/p>
&lt;h3 id="注意点">注意点&lt;/h3>
&lt;p>何故か 64bit バージョンは動きませんでした。理由はわかりませんが、こういう関係のソフトは32bit版のほうが今はまだ安定してる気がするし大量にメモリ使うこともないので気にしないことにします。&lt;/p>
&lt;p>&lt;code>ssh&lt;/code>だと&lt;code>ssh&lt;/code>コマンドはインストールされないので&lt;code>openssh&lt;/code>を指定しましょう。&lt;/p>
&lt;p>インストール後に&lt;code>/etc/passwd&lt;/code>のホームディレクトリ設定を&lt;code>/home/username&lt;/code>から&lt;code>cygdrive/c/Users/username&lt;/code>とWindowsのホームフォルダに変更しておくと&lt;code>ssh&lt;/code>とかのコマンドの時に設定ファイルを自動的に読みに行ってくれるので便利。便利というかしないとちゃんと動かない。&lt;/p>
&lt;p>あと環境変数に&lt;code>set HOME=%USERPROFILE%&lt;/code>もどこかに仕込んでたほうが良いかも。&lt;/p>
&lt;h3 id="util-linux">Util-Linux&lt;/h3>
&lt;p>何故かカレンダー表示の&lt;code>cal&lt;/code>コマンドが見つからなかったので探してみたら、&lt;code>cal&lt;/code>のみのインストールはないらしい。&lt;/p>
&lt;p>とりあえず&lt;code>util-linux&lt;/code>が良さそうなんでこれを使う事にした。&lt;/p>
&lt;h3 id="tree">tree&lt;/h3>
&lt;p>Windows由来のコマンドなのにWindowsの&lt;code>tree&lt;/code>コマンドは階層指定もできない残念仕様なので&lt;code>cygwin&lt;/code>のを入れました。&lt;code>tree -L 2&lt;/code>とかで階層指定できる。便利！&lt;/p></description></item><item><title>linuxで特定のファイルの最終行だけ削除する</title><link>https://hack.ironsand.net/2014/delete-list-line-of-a-file-in-linux-by-using-sed/</link><pubDate>Thu, 27 Mar 2014 11:57:07 +0000</pubDate><guid>https://hack.ironsand.net/2014/delete-list-line-of-a-file-in-linux-by-using-sed/</guid><description>&lt;p>Digital Ocean では OS を気軽に Droplet で作成して、気軽にポイポイ捨てれるのが売りですが、そのせいで &lt;code>ssh&lt;/code>で新しく繋ぎ直したホストに繋ごうとすると&lt;/p>
&lt;pre class="lang:default decode:true " >@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx.
Please contact your system administrator.
Add correct host key in /home/ironsand/.ssh/known_hosts to get rid of this message.
Offending RSA key in /home/ironsand/.ssh/known_hosts:18
RSA host key for 107.170.114.105 has changed and you have requested strict checking.
Host key verification failed.&lt;/pre>
&lt;p>と怒られてしまう。&lt;/p></description></item></channel></rss>