自分で作ったり提供したりするものは、まず自分自身で使ってみろろということです。自分じゃ使わないものなら人はいくらでも無責任にも無思考にもなれる。そういう投げやりな「サービス」やら「プロダクツ」なんて、だれだってイヤだ。自分が作り手と同時に利用者の立場になれば、ちゃんと使えるレベルのものを提供しようとします。

2011年11月26日土曜日

ssh設定

opensshパッケージインストール
openssh-server(クライアントパッケージも含む)
openssh-client

RSA設定手順
①RSAキー作成
ssh-keygen -t rsa -C "Koma RSA Test"
~/.ssh/id_rsa
~/.ssh/id_rsa.pub
②パブリックキーをサーバーにコピー
ssh-copy-id -i .ssh/id_rsa.pub username@server-ip
③ログインしてみる
ssh -i .ssh/id_rsa username@server-ip
④rsyncを実行してみる
rsync -auzxvv --delete -e ssh username@server-ip:/var/lib/ ~/lib
⑤サーバーでパスワードログインを禁止させる
sudo nano -w -i /etc/ssh/sshd_config
PermitRootLogin yes
PasswordAuthentication yes
UsePAM yes
下記のように変更する
PermitRootLogin no
PasswordAuthentication no
UsePAM no

サーバーSSHD再起動する
sudo /etc/init.d/ssh restart
パスワードログインを禁止しました。

OK!

補足:
Encrypted Home Directory

If you have an encrypted home directory, SSH cannot access your authorized_keys file because it is inside your encrypted home directory and won't be available until after you are authenticated. Therefore, SSH will default to password authentication.

To solve this, create a folder outside your home named /etc/ssh/ (replace "" with your actual username). This directory should have 755 permissions and be owned by the user. Move the authorized_keys file into it. The authorized_keys file should have 644 premissions and be owned by the user.

Then edit your /etc/ssh/sshd_config and add:

AuthorizedKeysFile /etc/ssh/%u/authorized_keys

Finally, restart ssh with:

sudo service ssh restart

The next time you connect with SSH you should not have to enter your password.

sshサーバータイムアウトの延長

sudo nano -wci /etc/ssh/sshd_config
...
#3600秒
ClientAliveInterval 3600
#リトライ回数
ClientAliveCountMax 12
...

sudo service sshd restart

0 件のコメント:

コメントを投稿

ホームページ