본문 바로가기

Linux

[Linux] 리눅스 계정 생성 (useradd)

1. Intro


Linux에서 어떻게 사용자 계정 생성을 하는지 알아보자


2. Process


● 같은 이름을 가진 계정이 있는지 확인한다.


$cat /etc/passwd | grep (account name)



위처럼, 결과가 없으면 해당하는 account name에 대한 중복 계정은 없다.


● 사용자 계정 생성 및 home directory path와 bash 환경 지정


- Ubuntu


options


-m: home directory 생성

-s /bin/bash: bash 환경 설정


$useradd (account name) -m (home directory 주소) -s /bin/bash


- CentOS


옵션을 주지 않아도 home directory 및 bash 환경 자동 설정


$useradd (account name)



28910의 UID, GID가 각각 생성

home directory 주소 설정

bash 환경 설정


$echo '(password)' | passwd --stdin (account name)



해당 계정에 password라는 비밀번호 설정