1. 루트 사용자로 전환
jungmin@bagjeongmin-ui-MacBookPro ~ % sudo -s
Password:
2. 사용자 추가
root@bagjeongmin-ui-MacBookPro ~ # sudo dscl . -create /Users/rathon
3. 추가한 사용한 UID(사용자ID) 할당
- 1001번 사용 중인지 조회해보고 없으니까 할당 후 확인!
root@bagjeongmin-ui-MacBookPro ~ # dscl . list /Users UniqueID | grep 1001
root@bagjeongmin-ui-MacBookPro ~ # sudo dscl . -create /Users/rathon UniqueID 1001
root@bagjeongmin-ui-MacBookPro ~ # dscl . list /Users UniqueID | grep 1001
rathon 1001
4. 추가한 사용한 GID(그룹 ID) 할당
- 간단한 작업을 위해 추가한 사용자라 admin 그룹까지는 아니고 staff 권한을 주겠다.
root@bagjeongmin-ui-MacBookPro /Users # ls -al
total 0
drwxr-xr-x 5 root admin 160 2 17 23:31 .
drwxr-xr-x 20 root wheel 640 2 3 2024 ..
-rw-r--r-- 1 root wheel 0 2 3 2024 .localized
drwxrwxrwt 7 root wheel 224 5 8 00:32 Shared
drwxr-x---+ 39 jungmin staff 1248 8 4 18:59 jungmin
- staff 그룹 아이디 조회
root@bagjeongmin-ui-MacBookPro /Users # dscl . -read /Groups/staff
AppleMetaNodeLocation: /Local/Default
GeneratedUID: ABCDEFAB-CDEF-ABCD-EFAB-CDEF00000014
GroupMembers: FFFFEEEE-DDDD-CCCC-BBBB-AAAA00000000 B5033C0C-C195-4FAC-B7ED-607CF32C2DCD
GroupMembership: root jungmin
Password: *
PrimaryGroupID: 20
RealName: Staff
RecordName: staff BUILTIN\Users
RecordType: dsRecTypeStandard:Groups
SMBSID: S-1-5-32-545
- 그룹 아이디 할당
root@bagjeongmin-ui-MacBookPro /Users # sudo dscl . -create /Users/rathon PrimaryGroupID 20
5. 사용자 홈 디렉토리 생성 / 소유자 변경
root@bagjeongmin-ui-MacBookPro /Users # ls -al
total 0
drwxr-xr-x 5 root admin 160 2 17 23:31 .
drwxr-xr-x 20 root wheel 640 2 3 2024 ..
-rw-r--r-- 1 root wheel 0 2 3 2024 .localized
drwxrwxrwt 7 root wheel 224 5 8 00:32 Shared
drwxr-x---+ 39 jungmin staff 1248 8 4 18:59 jungmin
root@bagjeongmin-ui-MacBookPro /Users #
root@bagjeongmin-ui-MacBookPro /Users #
root@bagjeongmin-ui-MacBookPro /Users #
root@bagjeongmin-ui-MacBookPro /Users #
root@bagjeongmin-ui-MacBookPro /Users #
root@bagjeongmin-ui-MacBookPro /Users # sudo mkdir /Users/rathon
root@bagjeongmin-ui-MacBookPro /Users # sudo chown rathon:staff /Users/rathon
root@bagjeongmin-ui-MacBookPro /Users # ls -al
total 0
drwxr-xr-x 6 root admin 192 8 4 19:33 .
drwxr-xr-x 20 root wheel 640 2 3 2024 ..
-rw-r--r-- 1 root wheel 0 2 3 2024 .localized
drwxrwxrwt 7 root wheel 224 5 8 00:32 Shared
drwxr-x---+ 39 jungmin staff 1248 8 4 18:59 jungmin
drwxr-xr-x@ 2 rathon staff 64 8 4 19:33 rathon
5. 사용자 홈 디렉토리 지정
root@bagjeongmin-ui-MacBookPro /Users # sudo dscl . -create /Users/rathon NFSHomeDirectory /Users/rathon
6. 사용자의 로그인 쉘 지정
root@bagjeongmin-ui-MacBookPro /Users # sudo dscl . -create /Users/rathon UserShell /bin/zsh
7. 비밀번호 설정
root@bagjeongmin-ui-MacBookPro /Users # sudo passwd rathon
Changing password for rathon.
New password:
Retype new password:
################################### WARNING ###################################
# This tool does not update the login keychain password. #
# To update it, run `security set-keychain-password` as the user in question, #
# or as root providing a path to such user's login keychain. #
###############################################################################
끝!
사용자 변경해서 작업하자
root@bagjeongmin-ui-MacBookPro /Users # su - rathon
rathon@bagjeongmin-ui-MacBookPro ~ %
'OS' 카테고리의 다른 글
OS 재부팅 시, Root가 아닌 일반 사용자로 데몬 자동 시작 설정하기 (0) | 2024.08.05 |
---|