2
2

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.

Ubuntu 14.04 LTS 開発環境構築ログ #03

Last updated at Posted at 2016-03-01

前記事:Ubuntu 14.04 LTS 開発環境構築ログ #02

鍵交換方式でSSH接続するための準備

秘密鍵&公開鍵のペアを作成

$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/cazborg/.ssh/id_rsa): <Enter>
Created directory '/home/cazborg/.ssh'.
Enter passphrase (empty for no passphrase): <パスフレーズ + Enter>
Enter same passphrase again: <パスフレーズ + Enter>
$

公開鍵の内容を ~/.ssh/authorized_keys に追加

$ cd ~/.ssh
$ cat id_rsa.pub >> authorized_keys

秘密鍵(~/.ssh/id_rsa)を作業用PCにSCP

TeraTerm の [ファイル]-[SSH SCP...] でダウンロード。
以後は秘密鍵を使用してSSH接続。

SSHD の設定を変更

root ユーザで SSH 接続できないよう設定を変更し、sshd を再起動

$ sudo cp -p /etc/ssh/sshd_config /etc/ssh/sshd_config.20160309
$ sudoedit /etc/ssh/sshd_config
$ cd /etc/ssh
$ diff -u sshd_config sshd_config.20160309
--- sshd_config 2016-03-09 00:59:48.000000000 +0900
+++ sshd_config.20160309        2014-09-04 17:24:13.000000000 +0900
@@ -25,7 +25,7 @@

 # Authentication:
 LoginGraceTime 120
-PermitRootLogin no
+PermitRootLogin yes
 StrictModes yes

 RSAAuthentication yes
$
$ sudo service ssh restart
2
2
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
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?