Help us understand the problem. What is going on with this article?

Amazon linuxを立てて最初にやることメモ (ユーザ追加など)

More than 3 years have passed since last update.

Amazon linuxを立てて最初にやることメモ (ユーザ追加など)

ユーザ追加

sudo su
useradd XXX

XXXはユーザ名

SSHの公開鍵登録

su XXX
cd
mkdir .ssh
chmod 700 .ssh
vi .ssh/authorized_keys
chmod 600 .ssh/authorized_keys
exit

.ssh/authorized_keysにクライアントの公開鍵を追記する。
クライアントの公開鍵作成コマンドは以下。
ssh-keygen -t rsa
クライアント側で生成される公開鍵id_rsa.pubの内容をauthorized_keysに追記する。

sudo権限付与

root権限で

visudo

以下の箇所に追記

## Allow root to run any commands anywhere
root    ALL=(ALL)       ALL
XXX     ALL=(ALL)       NOPASSWD:ALL

※パスワードなしでsudoできる例

デフォルトユーザ(ec2-user)削除

root権限で

userdel ec2-user

以下コマンドでユーザ一覧を表示して、削除されていることを確認

cat /etc/passwd|sed -e 's/:.*//g'

※/home/ec2-userも不要なので削除

rm -rf /home/ec2-user

yumアップデート

sudo yum update -y

よく使うツール類

gitとdocker

sudo yum install -y git docker

jq

sudo curl -o /usr/local/bin/jq -L https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64 && sudo chmod +x /usr/local/bin/jq

suzukihi724
各種備忘録
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした