Announce

PukiWiki contents have been moved into SONOTS Plugin (20070703)

useradd

Mac での useradd

その他「環境設定」を利用しない、コマンドラインの設定方法 http://d.hatena.ne.jp/shoma_jpn/20091021/1256083019

# /usr/bin/dscl . -list /Users | grep MyName <--ユーザ名重複を調べとく
# /usr/bin/dscl . -list /Users UniqueID <--ユーザIDの重複も..
_amavisd                83
_appowner               87
...
...
...
# /usr/bin/dscl . -list /Groups PrimaryGroupID <--グループ一覧も調べとく
...
_appserveradm                    81 <--- このへんに加える
_appserverusr                    79 <--- このへんに加える
...
_lpadmin                         98 <--- このへんに加える
...
admin                            80  <--- このへんに加える
...
staff                            20  <--- このへんに加える
#
# ...いよいよ登録...
# /usr/bin/dscl . -create /Users/MyName <-- ユーザ名
# /usr/bin/dscl . -create /Users/MyName RealName "My Name" <-- 名前
# /usr/bin/dscl . -create /Users/MyName UniqueID 501 <-- ユーザID
# /usr/bin/dscl . -create /Users/MyName PrimaryGroupID 20 <-- 所属プライマリグループ
# /usr/bin/dscl . -create /Users/MyName UserShell /bin/bash <-- 利用シェル
# /usr/bin/dscl . -create /Users/MyName NFSHomeDirectory /Users/MyName <-- ホームディレクトリ
#
# ...ホームディレクトリつくる...
# /usr/sbin/createhomedir -b -u MyName <-- ホームディレクトリつくる
creating home directories for (localhost)
# ls -la /Users/MyName/
total 0
drwxr-xr-x  12 MyName  staff  408 Dec 10 14:23 .
drwxr-xr-x   5 root   admin  170 Dec 10 14:23 ..
-rw-------   1 MyName  staff    4 Dec 10 14:23 .CFUserTextEncoding
drwx------+  3 MyName  staff  102 Dec 10 14:23 Desktop
drwx------+  4 MyName  staff  136 Dec 10 14:23 Documents
drwx------+  4 MyName  staff  136 Dec 10 14:23 Downloads
drwx------+ 22 MyName  staff  748 Dec 10 14:23 Library
drwx------+  3 MyName  staff  102 Dec 10 14:23 Movies
drwx------+  3 MyName  staff  102 Dec 10 14:23 Music
drwx------+  4 MyName  staff  136 Dec 10 14:23 Pictures
drwxr-xr-x+  4 MyName  staff  136 Dec 10 14:23 Public
drwxr-xr-x+  6 MyName  staff  204 Dec 10 14:23 Sites
#
# ...パスワード設定...
# su MyName
$ passwd
Changing password for MyName.
Old Password:
New Password: xxxxxxxx
Retype New Password: xxxxxxxx
$ exit
exit
#
# ...グループ権限を追加...
t# id MyName
uid=501(MyName) gid=20(staff) groups=20(staff),61(localaccounts),12(everyone) <-- 結構サビシイ...
# dscl . -append /Groups/admin GroupMembership MyName <-- adminを追加
# dscl . -append /Groups/_appserveradm GroupMembership MyName <-- _appserveradmを追加
# dscl . -append /Groups/_lpadmin GroupMembership MyName <-- _lpadminを追加
# dscl . -append /Groups/_appserverusr GroupMembership MyName <-- _appserverusrを追加
# id MyName
uid=501(MyName) gid=20(staff) groups=20(staff),503(com.apple.local.ard_interact),501(com.apple.local.ard_admin),204(_developer),100(_lpoperator),98(_lpadmin),81(_appserveradm),80(admin),79(_appserverusr),61(localaccounts),12(everyone),500(com.apple.access_ssh),502(com.apple.local.ard_reports),504(com.apple.local.ard_manage),401(com.apple.access_screensharing) <-- SSHとかVNCも管理もオッケー
#