Why not login to Qiita and try out its useful features?

We'll deliver articles that match you.

You can read useful information later.

3
4

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.

ユーザー追加方法の一連の流れ

Last updated at Posted at 2013-12-18

リモートサーバー上で作業する
追加したいユーザー名を totoman とする


#https://www.express.nec.co.jp/linux/distributions/knowledge/system/useradd.html

ユーザーを追加


sudo -s
useradd -m totoman
ls /home (追加したユーザー名があるか確認)

ssh公開鍵の設置


passwd totoman
cd /home/totoman (= su - totoman)

ls -la で .ssh が無ければ作成


mkdir .ssh
cd .ssh

ここに authorized_keys ファイルを作成してその中に追加したいユーザーのssh公開鍵を追加する


chmod 700 .ssh
chmod 600 authorized_keys

chown -R totoman:totoman .ssh
( -R は下の階層にあるファイル全てに上書き)

※ sudo 権限を付与する場合

gpasswd -a totoman sudo

確認

id totoman

これでサーバーにtotomanユーザーとしてパスワード無しでssh接続できるようになる.
その後,passwd コマンドを使ってそれぞれのユーザーのパスに設定しておく.

3
4
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

Comments

No comments

Let's comment your feelings that are more than good

Qiita Advent Calendar is held!

Qiita Advent Calendar is an article posting event where you post articles by filling a calendar 🎅

Some calendars come with gifts and some gifts are drawn from all calendars 👀

Please tie the article to your calendar and let's enjoy Christmas together!

3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?