계정을 생성하는 관리자용 명령어이므로 일반사용자들은 사용하지 않는 명령어이다.

또한 리눅스에서 useradd와 adduser명령어가 어떻게 다르냐고 질문하시는 분들이 있다.
다음의 사실을 명확하게 확인하기 바란다.

[root@host3 root]# ls -l /usr/sbin/adduser
rwxrwxrwx 1 root root 7 8월 28 02:29 /usr/sbin/adduser -> useradd
[root@host3 root]#


사용예 #1

useradd로 간단히 계정을 생성하는 예를 보았으므로 이번에는 좀 더 다양한 옵션사용의 예를 보도록 하자.

sspark1이라는 계정사용자를 다음과 같이 새로 생성하였다.

[root@host3 root]# useradd -d /home/sspark1 -u 600 -s /bin/csh sspark1
[root@host3 root]#

즉, 홈디렉토리위치를 /home/sspark1로 지정하였고, UID를 600으로 지정하였으며, 기본사용쉘을 C Shell로 지정하였다.
다음은 결과를 확인하 것이다.

[root@host3 root]# grep sspark1 /etc/passwd
sspark1:x:600:600::/home/sspark1:/bin/csh
[root@host3 root]#

[root@host3 root]# grep sspark1 /etc/group
sspark1:x:600:
[root@host3 root]#
[root@host3 root]# ls -al /home/sspark1
합계 32
drwx------ 3 sspark1 sspark1 4096 9월 19 11:46 .
drwxr-xr-x 8 root root 4096 9월 19 11:46 ..
-rw-r--r-- 1 sspark1 sspark1 24 9월 19 11:46 .bash_logout
-rw-r--r-- 1 sspark1 sspark1 191 9월 19 11:46 .bash_profile
-rw-r--r-- 1 sspark1 sspark1 124 9월 19 11:46 .bashrc
-rw-r--r-- 1 sspark1 sspark1 854 9월 19 11:46 .emacs
-rw-r--r-- 1 sspark1 sspark1 120 9월 19 11:46 .gtkrc
drwxr-xr-x 3 sspark1 sspark1 4096 9월 19 11:46 .kde
[root@host3 root]#

이렇게 옵션을 직접 지정하면 기본설정값에 우선하여 생성이 됨을 알아두기 바란다.


사용예 #2

다음의 예는 좀 더 다양한 옵션을 사용하여 계정을 생성한 예이다.

[root@host3 root]# useradd -c 박성수 -e 2004-12-12 -d /home/sspark2 -u 601 -s /bin/ksh -p 12345 sspark2
[root@host3 root]#

위에서 사용한 옵션을 간단히 설명하면 다음과 같다.

. -c 박성수 : 계정사용자의 간단한 설명
. -e 2004-12-12 : 계정사용 종료일자
. -d /home/sspark2 : 홈디렉토리 위치
. -u 601 : UID 601로 지정
. -s /bin/ksh : 사용할 기본쉘을 Korn Shell로 지정
. -p 12345 : 패스워드를 12345로 지정
. sspark2 : 생성할 계정명

위와 같이 지정한 다음 생성된 내용을 간단히 확인한 것이다.

[root@host3 root]# grep sspark2 /etc/passwd
sspark2:x:601:601:박성수:/home/sspark2:/bin/ksh
[root@host3 root]#
[root@host3 root]# grep sspark2 /etc/shadow
sspark2:12345:12314:0:99999:7::12764:
[root@host3 root]#
[root@host3 root]# grep sspark2 /etc/group
sspark2:x:601:
[root@host3 root]#

크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기

Posted by 홍반장

2004/01/08 10:17 2004/01/08 10:17
Response
No Trackback , No Comment
RSS :
http://tcbs17.cafe24.com/tc/rss/response/167

Trackback URL : http://tcbs17.cafe24.com/tc/trackback/167

« Previous : 1 : ... 6191 : 6192 : 6193 : 6194 : 6195 : 6196 : 6197 : 6198 : 6199 : ... 6391 : Next »

블로그 이미지

- 홍반장

Archives

Recent Trackbacks

Calendar

«   2024/05   »
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  
Statistics Graph

Site Stats

Total hits:
197618
Today:
127
Yesterday:
379