서버 user 관리 기본

Sungmin Kim·2023년 12월 11일
0

리눅스

목록 보기
7/12
post-thumbnail

유저 생성 및 확인

유저 생성

# option 1
sudo adduser username
# option 2
sudo useradd -m username

option1: user 생성(모든 것을 한번에 all in one으로 생성)
option2: user 생성 (-m 옵션은 홈디렉토리도 함께 생성하는 것을 의미)
-g 그룹 지정
-d 디렉토리 지정

Adding user `username' ...
Adding new group `username' (1001) ...
Adding new user `username' (1001) with group `username' ...
Creating home directory `/home/username' ...
Copying files from `/etc/skel' ...
New password: 
Retype new password: 
passwd: password updated successfully
Changing the user information for username
Enter the new value, or press ENTER for the default
	Full Name []: 
	Room Number []: 
	Work Phone []: 
	Home Phone []: 
	Other []: 
Is the information correct? [Y/n]

비밀번호 변경

sudo passwd username

생성된 사용자(유저) 확인

tail -n 3 /etc/passwd

루트(sudo) 권한 주기

# /etc/sudoers 파일을 열어줌
sudo visudo

# 파일 하단에 아래 문구를 추가
username    ALL=(ALL)    ALL       # sudo 명령어 실행시 password 입력
username    ALL=(ALL)    NOPASSWD: ALL # password 생략

권한부여 여부 확인

# username으로 로그인
su username
# root로 전환
sudo -i

유저 삭제

deluser username

Tip) 기본 명령어 모음
아래 사이트 참고
https://itholic.github.io/linux-basic-command/

profile
Computer Vision Engineer

0개의 댓글

관련 채용 정보