LoginSignup
0
0

More than 5 years have passed since last update.

[memo] AWS EC2 ユーザー作成

Last updated at Posted at 2018-02-22

ユーザー追加

新ユーザーjohn_doeを追加。

$ sudo useradd john_doe

パスワードを設定

$ sudo passwd john_doe

sudoユーザーへの追加。

$ sudo visudo
visudo
john_doe    ALL=(ALL)       ALL

※ root 用設定の直下に追加

SSH用の鍵作成

ユーザー変更

$ sudo su - john_doe

鍵作成

$ mkdir .ssh
$ cd .ssh
$ ssh-keygen

sshd_config設定

$ sudo vi /etc/ssh/sshd_config
/etc/ssh/sshd_config
/etc/ssh/sshd_configAuthorizedKeysFile      .ssh/authorized_keys

公開鍵をauthorized_keysへファイル名変更

$ mv id_rsa.pub authorized_keys

権限設定

$ chmod 600 authorized_keys
$ cd ../
$ chmod 700 .ssh

権限確認

$ ls -al ~/.ssh
-rw------- 1 john_doe john_doe authorized_keys
-rw------- 1 john_doe john_doe id_rsa
$ ls -al ~/
drwx------ 2 john_doe john_doe .ssh

以上

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