본문 바로가기

운영체제

계정 생성 실습

728x90

실습 - 사용자 계정 생성 

User : tester
UID : 1200
GID : tg
Shell : sh
HOME : /hosting
Skel : /skelsam
Auto Creating Directory : public_html
Auto Creating File : .sam

 

 

그룹생성

[root@localhost ~]#groupadd tg

 

디렉터리 hosting 생성 

[root@localhost ~]# mkdir /hosting

[root@localhost ~]# ls -ld /hosting

drwxr-xr-x 2 root root 4096 2021-06-14 17:26 /hosting

 

skelsam 생성

[root@localhost ~]# cp -r /etc/skel /etc/skelsam

 

skelsam에 디렉터리,파일 추가 

[root@localhost ~]# mkdir /etc/skelsam/public_html

[root@localhost ~]# touch /etc/skelsam/.sam

 

사용자 생성 

[root@localhost ~]# useradd -u 1200 -g tg -s /bin/sh -d /hosting -mk /etc/skelsam testuser

 

확인 

[root@localhost ~]# ls -al /hosting

합계 32

drwx------ 5 testuser tg   4096 2021-06-14 18:07 .

drwxr-xr-x 3 root     root 4096 2021-06-14 18:07 ..

-rw-r--r-- 1 testuser tg     18 2021-06-14 17:28 .bash_logout

-rw-r--r-- 1 testuser tg    176 2021-06-14 17:28 .bash_profile

-rw-r--r-- 1 testuser tg    124 2021-06-14 17:28 .bashrc

drwxr-xr-x 2 testuser tg   4096 2021-06-14 17:28 .gnome2

drwxr-xr-x 4 testuser tg   4096 2021-06-14 17:28 .mozilla

-rw-r--r-- 1 testuser tg      0 2021-06-14 17:35 .sam

drwxr-xr-x 2 testuser tg   4096 2021-06-14 17:33 public_html

 

[root@localhost ~]# tail -1 /etc/passwd

testuser:x:1200:623::/hosting/testuser:/bin/sh

 

[root@localhost ~]# tail -1 /etc/group

tg:x:623:

 

 

 

+ 사용 가능한 shell 목록

cat /etc/shells 

 

728x90