0
0

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 3 years have passed since last update.

ubuntuの初期設定

Posted at

概要

Ubuntu の手順

手順

OS インストール後

Set up users and passwords

Question Answer
Full name for the new user ${自分の名前を入力}
Username for your account ${アカウントのユーザ名を入力}
Choose a password for the new user ${パスワード入力}
Re-enter password to verify ${パスワード再入力}

Partiton disks

Question Answer
Partitioning method Guided - use entire disk
Select disk to partition Virtual disk 1 (vda)
Write the changes to disks? Yes

Finish the installation

  1. Continue 選択
  2. 再起動後に再接続

好みのサーバ設定

# 好みのテキストエディタ
$ sudo apt install vim

# 日本語設定
$ sudo apt install manpages-ja manpages-ja-dev language-pack-ja
$ sudo update-locale LANG=ja_JP.UTF-8

SSH認証設定

id_rsa 生成が初回の場合、ssh-keygen のみでよし。

既存の id_rsa と別管理にしたい場合、以下の手順とする。

# ローカル
## 新サーバ用の SSH Key を生成
$ cd ~/.ssh/

$ ssh-keygen -t rsa -b 4096 -f id_rsa_${別名用の suffix}
> 全部リターンでも良い ( 強度高めたい場合は追加調査 )

## 公開鍵を新サーバに送信
$ scp ./id_rsa_${別名用の suffix}.pub ${ユーザ名}@${IPアドレス}:~/
# リモートサーバ
## SSH接続元に対して接続を許可する公開鍵を設置する `.ssh/authorized_keys` 設定

$ mkdir .ssh

$ mv ${公開鍵} ./.ssh

$ chmod 700 .ssh/

$ cat ${公開鍵} >> .ssh/authorized_keys

$ chmod 600 .ssh/authorized_keys

$ rm ${公開鍵}

SSH接続時の設定ファイル

ここまでの設定では、SSH接続時に ssh ${ユーザ名}@${IPアドレス}:~/ -i ${秘密鍵のファイル名} と入力する必要がある。

そのため、~/.ssh/config を設定することにより、入力を省略可能にする。

$ vim .ssh/config
~/.ssh/config
Host ${ssh コマンドで使用する任意のサーバ名}
  User ${接続先のユーザ名}
  Hostname ${接続先のIPアドレス}
  IdentityFile ~/.ssh/${生成した秘密鍵名}

パスワードログインを無効化

$ sudo vim /etc/ssh/sshd_config
/etc/ssh/sshd_config
- #PasswordAuthentication yes
+ PasswordAuthentication no
$ sudo service ssh restart

断念したこと

IP 制限

固定 IP が必要になるが、家庭用回線において、基本的に別途オプションが必要である。

nuro 光の場合は、ビジネス契約が必要になるから、設定不可だった。

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?