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

Ubuntu 14.04 LTS (64bit)でユーザ追加・sudo権限追加する手順

Posted at

VPSでUbuntuをレンタルした際に実施するユーザ追加手順を記載する。
一部、VPSのサービス依存の手順がある場合は、筆者が利用しているDTIのサービスを前提として記載するので注意。

前提

  • ユーザ名:py-app
  • グループ名:py-app

ユーザ追加

ユーザ追加コマンドを実行

adduserコマンドで追加できる。
コマンド実行後に、名前や電話番号を入力するよう促されるが、パスワード以外は空白状態でエンターを押してもかまわない。

root@localhost:~# adduser py-app   
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = (unset),
	LANG = "ja_JP.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Adding user `py-app' ...
Adding new group `py-app' (1000) ...
Adding new user `py-app' (1000) with group `py-app' ...
Creating home directory `/home/py-app' ...
Copying files from `/etc/skel' ...
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully
Changing the user information for py-app
Enter the new value, or press ENTER for the default
	Full Name []: 
	Room Number []: 
	Work Phone []: 
	Home Phone []: 
	Other []: 
Is the information correct? [Y/n] Y
root@localhost:~# 

作成したユーザの確認

root@localhost:~# cat /etc/passwd|grep py-app
py-app:x:1000:1000:,,,:/home/py-app:/bin/bash
root@localhost:~# 

sudo権限追加

以下のコマンドで、sudo権限を付与できる。
※gpasswd は、指定したユーザに指定したグループを設定するコマンド。今回はpy-appユーザをsudoグループに入れる、という操作を行う。

root@localhost:~# gpasswd -a py-app sudo
Adding user py-app to group sudo
root@localhost:~# 
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?