Help us understand the problem. What is going on with this article?

hetemlで公開鍵を使う方法

More than 5 years have passed since last update.

hetemlダサいけど使う場面が来たけど公開鍵方式のSSHログインがやっぱりダサかったので書いとく。

0. 下準備

コントロールパネルからSSHを有効にしとく
https://admin.heteml.jp/web/ssh/

1. SSHホストを追加【ローカル】

Host heteml
    HostName sshXXX.heteml.jp
    User YOUSERNAME
    Port 2222
IdentitiesOnly yes
PreferredAuthentications password

2. 公開鍵生成【ローカル】

ローカルで公開鍵を作成。すでにある場合はスキップ。

$ cd ~/.ssh
$ ssh-keygen -t rsa

heteml上にコピー。いったんユーザールートに。

$ scp ~/.ssh/id_rsa.pub heteml:~/

3. 公開鍵を設置【heteml】

まずログイン。

$ ssh heteml

パスワードを聞かれるので入力。ログイン完了。

先ほどの鍵をauthorized_keysに変更し、一旦ログアウト。

$ mkdir .ssh
$ mv id_rsa.pub .ssh/authorized_keys
$ chmod 600 .ssh/authorized_keys
$ exit

4. パスワード接続を解除【ローカル】

先ほどのホスト設定からPreferredAuthentications部分をコメントアウト。

Host heteml
    HostName sshXXX.heteml.jp
    User YOUSERNAME
    Port 2222
IdentitiesOnly yes
# PreferredAuthentications password //コメントアウト or 削除

これでSSHログインでパスワードを聞かれることはなくなります。

$ ssh heteml
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした