UJP - 技術情報2 : Rapsberry Pi3のRaspbianでユーザの追加と削除を行う RapsberryPi3/003/UserAddUserDel

Life is fun and easy!

不正IP報告数

Okan Sensor
 
メイン
ログイン
ブログ カテゴリ一覧

Rapsberry Pi3のRaspbianでユーザの追加と削除を行う anchor.png

Page Top

はじめに anchor.png

 Raspbianにはpiユーザがデフォルトで作成されているが,そういうみんなが知っているユーザIDを使うのはリスクがあるので封鎖する.その代わり別のユーザを作成する.

pi@commet:~ $ su - root
パスワード:
root@commet:~#
root@commet:~# cat /etc/passwd|grep -v false|grep -v nologin
root:x:0:0:root:/root:/bin/bash
sync:x:4:65534:sync:/bin:/bin/sync
pi:x:1000:1000:,,,:/home/pi:/bin/bash
root@commet:~#
root@commet:~# userdel -r pi
userdel: user pi is currently used by process 756
root@commet:~#
root@commet:~# adduser ujpadmin
ユーザ `ujpadmin' を追加しています...
新しいグループ `ujpadmin' (1001) を追加しています...
新しいユーザ `ujpadmin' (1001) をグループ `ujpadmin' として追加しています...
ホームディレクトリ `/home/ujpadmin' を作成しています...
`/etc/skel' からファイルをコピーしています...
新しい UNIX パスワードを入力してください:
新しい UNIX パスワードを再入力してください:
passwd: パスワードは正しく更新されました
ujpadmin のユーザ情報を変更中
新しい値を入力してください。標準設定値を使うならリターンを押してください
	フルネーム []: UJP admin
	部屋番号 []:
	職場電話番号 []:
	自宅電話番号 []:
	その他 []:
以上で正しいですか? [Y/n] y
root@commet:~#
root@commet:~# cat /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults	env_reset
Defaults	mail_badpass
Defaults	secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root	ALL=(ALL:ALL) ALL
# Allow members of group sudo to execute any command
%sudo	ALL=(ALL:ALL) ALL
# See sudoers(5) for more information on "#include" directives:
#includedir /etc/sudoers.d
pi ALL=(ALL) NOPASSWD: ALL
root@commet:~#
root@commet:~# echo 'ujpadmin ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
root@commet:~#
root@commet:~# cat /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults	env_reset
Defaults	mail_badpass
Defaults	secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root	ALL=(ALL:ALL) ALL
# Allow members of group sudo to execute any command
%sudo	ALL=(ALL:ALL) ALL
# See sudoers(5) for more information on "#include" directives:
#includedir /etc/sudoers.d
pi ALL=(ALL) NOPASSWD: ALL
ujpadmin ALL=(ALL) NOPASSWD: ALL
root@commet:~#
ujpadmin@commet:~ $ sudo su -
root@commet:~#
root@commet:~# cat /etc/passwd|grep -v false|grep -v nologin
root:x:0:0:root:/root:/bin/bash
sync:x:4:65534:sync:/bin:/bin/sync
pi:x:1000:1000:,,,:/home/pi:/bin/bash
ujpadmin:x:1001:1001:UJP admin,,,:/home/ujpadmin:/bin/bash
root@commet:~#
root@commet:~# cat /etc/passwd|grep -v false|grep -v nologin
root:x:0:0:root:/root:/bin/bash
sync:x:4:65534:sync:/bin:/bin/sync
#pi:x:1000:1000:,,,:/home/pi:/bin/bash
ujpadmin:x:1001:1001:UJP admin,,,:/home/ujpadmin:/bin/bash
root@commet:~#
root@commet:~# sudo su - pi
ユーザ 'pi' のパスワードエントリがありません
root@commet:~#

Front page   Diff Backup Copy Rename Reload   New Page Page list Search Recent changes   Help   RSS of recent changes (RSS 1.0) RSS of recent changes (RSS 2.0) RSS of recent changes (RSS Atom)
Counter: 1199, today: 1, yesterday: 0
Last-modified: 2016-07-04 (Mon) 02:14:05 (JST) (3146d) by shinnai(shinnai)

広告スペース
Google