"리눅스"의 두 판 사이의 차이
(→특정계정으로 명령어 실행) |
(→사용자 추가) |
||
(같은 사용자의 중간 판 4개는 보이지 않습니다) | |||
1번째 줄: | 1번째 줄: | ||
+ | == 배포판 == | ||
+ | $ cat /etc/*-release | ||
+ | [[Debian]] | ||
+ | |||
+ | [[Alpine]] | ||
+ | |||
== 보안 == | == 보안 == | ||
26번째 줄: | 32번째 줄: | ||
$ id | $ id | ||
− | === | + | === 사용자 추가 === |
+ | <syntaxhighlight lang="bash"> | ||
+ | sudo useradd -m newuser | ||
+ | sudo passwd newuser | ||
+ | </syntaxhighlight>passwd명령으로 패스워드를 지정하지 않으면 해당 계정은 잠금상태이다. | ||
+ | |||
+ | -M 옵션을 사용하면 홈 디렉토리를 만들지 않는다. | ||
+ | |||
+ | === 그룹 추가 === | ||
$ groupadd 그룹명 | $ groupadd 그룹명 | ||
43번째 줄: | 57번째 줄: | ||
==디렉토리== | ==디렉토리== | ||
− | * /sbin | + | 다음 명령으로 매뉴얼을 확인할 수 있다. |
+ | $ man hier | ||
+ | |||
+ | */bin : 필수 명령어 | ||
+ | */sbin : system programs and administration utilities | ||
+ | */usr : This directory is '''us'''ually mounted from a serparate partiontion('s resources). 리눅스가 실행중인 다양한 머신에서 마운트될 수 있다. | ||
+ | */usr/local : This is where programs which are local to the site typically go. 직접 컴파일해서 설치하는 등. | ||
* /media/mnt 대체 | * /media/mnt 대체 | ||
* /lost+found 훼손된 파일장소 | * /lost+found 훼손된 파일장소 | ||
* /proc 시스템 정보를 저장하는 가상 파일 시스템 | * /proc 시스템 정보를 저장하는 가상 파일 시스템 | ||
+ | |||
==파일== | ==파일== | ||
* /etc/issue 콘솔로 접속했을 때 처음으로 출력될 내용 | * /etc/issue 콘솔로 접속했을 때 처음으로 출력될 내용 |
2023년 6월 18일 (일) 05:11 기준 최신판
배포판[편집 | 원본 편집]
$ cat /etc/*-release
보안[편집 | 원본 편집]
nginx 보안[편집 | 원본 편집]
ufw 기본설정[편집 | 원본 편집]
알려진 포트 : /etc/services
내부네트워크 허용[편집 | 원본 편집]
$ sudo ufw allow from 192.168.0.0/24
SSH 보안[편집 | 원본 편집]
접속 로그[편집 | 원본 편집]
# last
접속 실패 로그[편집 | 원본 편집]
#last -f /var/log/btmp
비밀번호 접속 금지 설정[편집 | 원본 편집]
사용자 관리[편집 | 원본 편집]
사용자 정보는 /etc/passwd에 저장된다.
계정상태 확인[편집 | 원본 편집]
$ id
사용자 추가[편집 | 원본 편집]
sudo useradd -m newuser
sudo passwd newuser
passwd명령으로 패스워드를 지정하지 않으면 해당 계정은 잠금상태이다.
-M 옵션을 사용하면 홈 디렉토리를 만들지 않는다.
그룹 추가[편집 | 원본 편집]
$ groupadd 그룹명
유저를 그룹에 추가[편집 | 원본 편집]
$ usermod --append --groups 그룹명 유저명
새로운 로그인 후부터 적용된다.
혹은
$ usermod -aG 그룹명 유저명
유저를 그룹에서 제거[편집 | 원본 편집]
$ gpasswd --delete 유저명 그룹명
다른 사용자로 명령 실행[편집 | 원본 편집]
$ sudo -u www-data cmd
디렉토리[편집 | 원본 편집]
다음 명령으로 매뉴얼을 확인할 수 있다.
$ man hier
- /bin : 필수 명령어
- /sbin : system programs and administration utilities
- /usr : This directory is usually mounted from a serparate partiontion('s resources). 리눅스가 실행중인 다양한 머신에서 마운트될 수 있다.
- /usr/local : This is where programs which are local to the site typically go. 직접 컴파일해서 설치하는 등.
- /media/mnt 대체
- /lost+found 훼손된 파일장소
- /proc 시스템 정보를 저장하는 가상 파일 시스템
파일[편집 | 원본 편집]
- /etc/issue 콘솔로 접속했을 때 처음으로 출력될 내용
시작 프로그램[편집 | 원본 편집]
/etc/rc.local
전원관리[편집 | 원본 편집]
관련서비스[편집 | 원본 편집]
systemctl명령으로 삭제/등록할 수 있다.
- unmask sleep.target
- suspend.target
- hibernate.target
- hybrid-sleep.target
특정계정으로 명령어 실행[편집 | 원본 편집]
$ sudo -u 아이디 "명령어"
find[편집 | 원본 편집]
파일 검색, depth를 지정하지 않으면 모든 하위 디렉토리를 포함한다.
$ find directory-location -group {group-name} -name {file-name}
퍼미션 검색
$ find . -perm -g=x -type f
파일검색 후 명령실행
$ find . -name "*.mp3" -exec ./test.sh {} \;
$ find . -type f -exec chmod o-w {} \;
- exclude path
find . -path ./misc -prune -o -name '*.txt' -print
signal[편집 | 원본 편집]
유닉스 계열 OS에서 프로세스간 통신이다.
inerrupt[편집 | 원본 편집]
SIGINT SIG=signal INT=inerrupt
Ctrl+C
Segmentation Violation[편집 | 원본 편집]
SIGSEGV SIG=signal SEGV= Segmentation Violation
잘못된 메모리 참조.
에러메시지: Program terminated with signal SIGSEGV, Segmentation fault.
Terminal Stop[편집 | 원본 편집]
SIGTSTP
Ctrl+Z
터미널 정지 신호.
QUIT[편집 | 원본 편집]
SIGQUIT
종료뒤 코어덤프
Ctrl+\