openssh

Table of Contents

Openssh server

1 Installation

sshdが常在しssh clientやscpの要求にssh serverが答える。 sudo apt-get install openssh-client sudo apt-get install openssh-server

2 Configuration(不要である)

/etc/ssh/sshdconfig の編集。 man sshdconfigを参照。 sudo cp /etc/ssh/sshdconfig /etc/ssh/sshdconfig.original sudo chmod a-w /etc/ssh/sshdconfig.original(書き込み許可を取り去る)

To set your OpenSSH to listen on TCP port 2222 instead of the default TCP port 22, change the Port directive as such:

Port 2222

To have sshd allow public key-based login credentials(信任状)、simply add or modify the line:

PubkeyAuthentication yes

If the line is already present, then ensure it is not commented out.

To make your OpenSSH server display the contents of the /etc/issue.net file as a pre-login banner, simply add or modify the line:

Banner /etc/issue.net

In the /etc/ssh/sshdconfig file.

sudo /etc/init.d/ssh restart

3 SSH Keys

このマニュアルではdsaであったがなぜかうまく行かず、rsaとした。

以下の3つのコマンドでうまくいく。

ssh-keygen -t rsa

passwordを要求されるがエンターを押すのみで良い。 defaultで the public key は ~/.ssh/idrsa.pub, 一方 ~/.ssh/idrsa は private key. idrsa.pub file を remote hostにコピーし /.ssh/authorizedkeys に追加するには:

ssh-copy-id username@remotehost

chmod 600 .ssh/authorizedkeys(所有者のみ読み書き可)

Author: ouryouji

Created: 2019-11-18 月 11:30

Emacs 24.5.1 (Org mode 8.2.10)

Validate