LoginSignup
3
4

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