주 메뉴 열기

wwiki β

리눅스

Jhkim (토론 | 기여)님의 2023년 2월 10일 (금) 02:25 판 (배포판)

목차

배포판

$ cat /etc/*-release

Debian

Alpine

보안

nginx 보안

ufw 기본설정

알려진 포트 : /etc/services

내부네트워크 허용

$ sudo ufw allow from 192.168.0.0/24

SSH 보안

접속 로그

# last

접속 실패 로그

#last -f /var/log/btmp

비밀번호 접속 금지 설정

SSH 설정파일

사용자 관리

사용자 정보는 /etc/passwd에 저장된다.

계정상태 확인

$ id

그룹추가

$ 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+\