1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

SSH Tectia ServerとOpenSSH(client)の公開鍵接続設定

Last updated at Posted at 2019-11-11

はじめに

自分は現在とある大学に通っているのですが、そこのsshサーバがOpenSSHでなくTectia Serverとかいうもので、公開鍵設定が簡単にはできませんでした。(丸2年かかった。)
自分と同じように困る人がいるかもしれないので書いておきます、

前提

そのTectia Serverにsshで接続できるようにしてください。password認証が使えればOKdesu.
そのサーバーがTectia Serverかどうかはssh -vvvの出力を見ればわかります。

debug1: Remote protocol version 2.0, remote software version 6.4.17.188 SSH Tectia Server

こんな行があればTectiaです。

手順

そのサーバーにssh接続してssh-keygen-g3を実行しましょう。
(普通、OpenSSH同士ならClient側で鍵を生成しますが、Tectia用の鍵をOpenSSHで作成する方法がわかりませんでした。ちょっと危険かも)
やってみると

$: ssh-keygen-g3
Generating 2048-bit rsa key pair
   6 Oo.oOo.ooOo.
Key generated.
2048-bit rsa, UserID@hostname, Tue Nov 12 2019 04:06:55 +0900
Passphrase :
Again      :
Key is stored with NULL passphrase.
 (You can ignore the following warning if you are generating hostkeys.)
 This is not recommended.
 Don't do this unless you know what you're doing.
 If file system protections fail (someone can access the keyfile),
 or if the super-user is malicious, your key can be used without
 the deciphering effort.
Private key saved to ~/.ssh2/id_rsa_2048_a
Public key saved to ~/.ssh2/id_rsa_2048_a.pub

と出るはずです。
自分はPassphraseを設定しませんでしたが、危険なので設定した方がいいかもしれません。(警告も出てるし)
Passphrase : と出たら好きなものを入力し、Again :と出たら同じものを入力しましょう。(何も入力せずにEnterをおせばlogin時にPassphraseを求められなくなります。)

次に$ chmod 700 .ssh2/で公開鍵の保存してあるディレクトリのパーミッションを変更しておきます。多分やらないと接続時にエラーが出ます。

次にcat >> ~/.ssh2/authorizationを実行して

Key     id_rsa_2048_a.pub

と打ってCtrl-Dで入力終了します。

これでOpenSSHでいうauthorized_keysの設定が終了し、あとはクライアント側の作業に移ります。

$ scp UserID@Hostname:~/.ssh2/id_rsa_2048_a 

で秘密鍵をダウンロードしてください。

次に

$ ssh-keygen -i -f id_rsa_2048_a > ~/.ssh/sshgate.key
$ chmod 600 ~/.ssh/sshgate.key

でtectiaの鍵をOpenSSH用の鍵に変換します。(こんなことができるなら2年前に知りたかった。)

最後に

ssh UserID@Hostname -i ~/.ssh/sshgate.key

で接続テストしてみてください。
接続できれば今日からあなたはsshやscpの使用時に一々passwordを打たなくても良くなります。
やったね!!

あとserver側の~/.ssh2/id_rsa_2048_aは削除しておいてね

まとめ

ssh-keygen -i -fでtectia server用の鍵をOpenSSH用の鍵に変換できます。

追記

ついに我が大学のsshサーバーもOpenSSHになりました。他にも潜在していたセキュリティの問題も解決されそうです。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?