본문 바로가기

Engineering/__00. Linux

(36)
evtest - Input device event monitor and query tool Sample 1.In the file /etc/system/logind.conf HandlePowerKey=poweroff or HandlePowerKey section is none? (It is set to handlepowerkey=power off or not at all. Also, after configuration change, it should be tested after rebooing.) 2.Please check the evtest result. # sudo evtest No device specified, trying to scan all of /dev/input/event* Available devices: /dev/input/event0: Power Button /dev/inpu..
nc - arbitrary TCP and UDP connections and listens (출처) https://linux.die.net/man/1/nc nc(1) - Linux man page Name nc - arbitrary TCP and UDP connections and listens Synopsis nc [-46DdhklnrStUuvzC] [-i interval] [-p source_port] [-s source_ip_address] [-T ToS] [-w timeout] [-X proxy_protocol] [ -x proxy_address[ :port]] [hostname] [port[s]] Description The nc (or netcat) utility is used for just about anything under the sun involving TCP or UDP...
DISK 검사와 read only mount 조치 법 mount 상태가 아래와 같이 ro (read only)로 자주 변경 되는 경우나 ata, I/O error 같은 메시지가 자주 발생하는 경우 등 Storage 문제로 추정되는 상황이 발생하는 경우가 있다. ex 1) # mount rootfs on / type rootfs (rw) /dev/root on / type ext2 (rw) /dev/sda1 on /mnt/kernel type msdos (rw,fmask=0022,dmask=0022,codepage=cp437) /dev/sda2 on /xxx/conf type ext3 (rw,data=ordered) /dev/sda3 on /usr/local type ext3 (rw,data=ordered) none on /proc type proc (rw)..
[터미널 단축기] Ctrl + u : 커서 왼쪽 문자 삭제 (그리고 버퍼 저장) Ctrl + k : 커서 오른쪽 문자 삭제 Ctrl + b : 커서를 왼쪽으로 이동 (왼쪽 화살표 키와 동일) Ctrl + e : 커서를 문자열 끝으로 이동 (END 키와 동일) Ctrl + a : 커서를 문자열 처음으로 이동 (HOME 키와 동일) Ctrl + xx : 커서를 이전 위치로 이동 Ctrl + y : 버퍼 저장내용 붙이기 (삭제된 문자열 삽입) Ctrl + l : clear 명령과 동일 Ctrl + m : enter키 Ctrl + d : 글자 없을 땐 로그아웃, 커서 위치 다음 문자 지움 Alt + d : 커서 위치의 다음 단어 지움 Ctrl + s : 키보드 lock Ctrl + q : 키보드 unlock Ctrl + p : ..
open 된 서비스 찾기 (lsof) (펌) https://devconnected.com/how-to-flush-dns-cache-on-linux/ Finding your local DNS resolver On most Linux systems, the DNS resolver is either “systemd-resolved” or dnsmasq. In order to know if you are dealing with one or another, you can execute the following command $ sudo lsof -i :53 -S Note : so why are we running this command? As DNS runs on port 53, we are looking for the commands associa..
[Sendmail/Postfix] [메일서버 도메인 적용] 1. /etc/hosts/hosts /etc/hosts 127.0.0.1 localhost.localdomain localhost test.qahuni.kr test 127.0.1.1 test 125.140.117.5 test.qahuni.kr 2. # hostnamectl set-hostname # hostnamectl set-hostname test.qahuni.kr # hostnamectl Static hostname: root@mail:~# hostnamectl Static hostname: test.qahuni.kr Icon name: computer-vm Chassis: vm Machine ID: 4b8545291b5e497d8c3652bf559f9ba2 Boot ID..
삭제된 파일 복구하기 파티션A 에 있던 삭제된 파일을 복구하기 위해서는 파티션A에 더 이상의 파일은 생성되지 않은 상태여야 한다. 파티션A 에서 지워진 파일은 파티션B 로 복구한다. apt-get install testdisk testdisk [CREATE] 실행 복구하고자 하는 (삭제된 파티션A) 원본 파티션 선택 [None] 선택 [Advanced] 보여지는 해당 파티션 선택 [List] 적색으로 표시된 삭제된 폴더 또는 파일을 선택 후 c (소문자) 복구할 위치 (파티션B) 선택 후 C (대문자)
Ubuntu apt 패키지 의존성 문제 Ubuntu 에서 apt 로 install 하려는데 다음과 같이 패키지 의존성 문제로 실패하는 경우가 종종 생긴다. (모든 명령은 root 계정이 아니라 사용자 계정에서 sudo 명령으로 수행하는 것이 좋다. 여기서 설명은 편의상 root 계정으로 한다.) root@ubuntu:/opt/test# apt-get install testdisk 패키지 목록을 읽는 중입니다... 완료 의존성 트리를 만드는 중입니다 상태 정보를 읽는 중입니다... 완료 다음을 바로잡으려면 'apt-get -f install'을 실행해 보십시오: 다음 패키지의 의존성이 맞지 않습니다: libperl5.22 : 의존: perl-modules-5.22 (>= 5.22.1-9ubuntu0.5) 하지만 5.22.1-9ubuntu0.3 ..
[Sendmail] dsn=4.0.0, stat=Deferred: Transport endpoint is not connected 특정 도메인으로 메일 발송 시 다음과 같이 문제가 발생하고 메일이 발송되지 않음 Mar 5 11:36:31 mail sendmail[29292]: 0252aV8h029290: to=, ctladdr= (0/0), delay=00:00:00, xdelay=00:00:00, mailer=esmtp, pri=120336, relay=a.b.c.d. [1.2.3.4], dsn=4.0.0, stat=Deferred: Transport endpoint is not connected deferred 처리되고 발송되지 않다가 sendmail 서비스를 다시 실행하거나 QUEUE 처리가 다시 되는 시점에서야 메일 발송됨. 메일을 발송하는 로컬 서버에서는 패킷 자체가 나가지 않음. telnet으로 a.b.c.d [1.2.3..
[ufw] 출처 : https://help.ubuntu.com/community/UFW UFW차례IntroductionUFW - Uncomplicated FirewallBasic Syntax and ExamplesDefault rules are fine for the average home userEnable and DisableAllow and Deny (specific rules)Delete Existing RuleServicesStatusLoggingAdvanced SyntaxAllow AccessDeny AccessWorking with numbered rulesEditing numbered rulesAdvanced ExampleInterpreting Log EntriesOther ResourcesIntro..
[service] ubuntu service 등록 관리 16.04 기준 1. 파일 생성 /lib/systemd/system/teamspeak.service /etc/systemd/system/multi-user.target.wants/teamspeak.service -> /lib/systemd/system/teamspeak.service [Unit]Description=TeamSpeak 3 ServerAfter=network.target [Service]WorkingDirectory=/home/teamspeak/User=teamspeakGroup=teamspeakType=forkingExecStart=/home/teamspeak/ts3server_startscript.sh startExecStop=/home/teamspeak/ts3server_startscr..
[Terminal] Serial Terminal Size 변경 Linux Serial 을 사용할 경우 row 수가 기본 24 line 으로 되어 있어 불편하다.이를 조정하는 방법 중 하나. $ sudo stty size 24 80 $ sudo stty rows 80 cols 80 $ sudo stty size 80 80 바로 동작하지 않는데 이 경우 다음 명령 입력 $ sudo screen (특이사항, su - user01 등으로 계정을 바꾸거나 해서 다시 실행하면 안되는 경우가 있다.)
[SAMBA] smb.conf * 기타 보안 이슈를 해결하고 samba 를 이용한 파일 공유 시 conf 예제 [abc] (공유이름) comment = abc folder path = /storage/abc writable = yes valid users = user01, user02 (그룹인 경우 @user) create mask = 0775 directory mask = 0775 browseable = no public = no guest ok = no * 그룹 권한을 관리하기 위해 /storage/a, /storage/b 폴더가 있다고 가정하자. 사용자 계정은 user01, user02 ... user10 까지 있다. user01 ~ user05 는 a 폴더만 samba 접근을 허용하고 user06 ~ user10 은 b 폴더만..
[파일권한] getfacl, setfacl, chacl chmod 로의 권한은 문제가 없는데 읽기 전용 등으로 파일 권한이 이상한 경우가 있다.이 경우 file acl 을 확인한다. getfacl 로 확인하고 setfacl 로 설정한다.기본 설정으로 변경하려면 # chacl -R file명 명령을 수행한다.
AES-NI OpenSSL 에서 AES-NI를 사용하고 있는 지의 확인을 성능으로 확인하는 방법 (펌) http://ask.xmodulo.com/check-aes-ni-enabled-openssl.html How to check if AES-NI is enabled for OpenSSL on LinuxPosted on November 30, 2016 by Dan Nanni2 CommentsQuestion: I have a Linux server which has Intel AES-NI hardware capability. I would like to check whether currently installed OpenSSL can use AES-NI acceleration.Intel Advanced Encryptio..
uuid , fstab, ntfs ntfs-3g mount root@ubuntu:~# ls /dev/disk/by-uuid/ -alh합계 0drwxr-xr-x 2 root root 100 3월 23 22:55 .drwxr-xr-x 5 root root 100 3월 23 22:55 ..lrwxrwxrwx 1 root root 10 3월 23 22:55 1d593f8d-db35-471e-9b0b-5e5935792384 -> ../../sda1lrwxrwxrwx 1 root root 10 3월 23 22:55 C8C41ADBC41ACB96 -> ../../sdb1lrwxrwxrwx 1 root root 10 3월 23 22:55 b92d53c4-cc71-4fd2-b08f-51a4152c3083 -> ../../sda5root@ubuntu:~# cat /etc/fsta..
maximum file count (출처) http://meetup.toast.com/posts/54, http://board.theko.co.kr/bbs/board.php?bo_table=B11&wr_id=140 시스템에서 현재 Open 되어 있는 파일 개수 확인 과 관련하여, limits.conf 와 sysctl.conf 의 차이점이 있다. sysctl.conf 는 시스템에서 전체 File Open 개수를 설정하고, limits.conf 는 계정별로 File Open 을 설정한다. 시스템의 전체 File Open 개수 확인 하기 (fs.nr_open 파라미터는 하나의 프로세스가 열 수 있는 최대 파일 개수) cat /proc/sys/fs/file-nr 3328 0 97764 3328 - 현재 오픈 가능한 최대 파일 개수 0 - 커널에..
[Ubuntu] system boot problem 부팅 중 다음과 같은 메시지가 나오며 부팅 실패 Gave up waiting for root device. Common problems:- Boot args (cat /proc/cmdline) - Check rootdelay= (did the system wait long enough?) - Check root= (did the system wait for the right device)- Missing modules (cat /proc/modules; ls /dev)ALERT! /dev/disk/by-uuid/96889309-5f73-4688-8354-e64cd1bb158f does not exist. Dropping to a shell! 우선 exit로 부팅을 진행한다.
[NFS RPC] portmap 서비스는 NIS와 NFS와 같은 RPC 서비스에 사용되는 동적 포트 할당 데몬이다. 이 데몬은 허술한 인증 메커니즘을 갖추고 있으며 데몬이 제어하는 서비스에 광범위한 포트를 할당 가능하다. 보안 문제로 NFS version 4 부터는 사용되지 않는다.NFS Version 4는 default 로 TCP 2049 port 를 사용한다.NFS Version 2 또는 3를 특정한 목적으로 사용하려면 /etc/nfsmount.conf 를 수정한다. 시험 등의 이유로 TCP 111 portmap 을 사용하려면 version 3과 같이 변경하여 재실행한다.[root@sv ~]# vim /etc/nfsmount.conf 1 # 2 # /etc/nfsmount.conf - see nfsmount.conf(..
[SSH] alive (from) https://kr.godaddy.com/help/how-to-set-an-ssh-timeout-12300 How to set an SSH timeoutSetting a distinct timeout period for SSH connections on your server is an important and simple step to maintaining both server stability and security. The common SSH daemon tool found on most Linux distributions makes this process easy to handle and additional shell settings even offer the ability to dis..
[LVM] LVM 관련 1. 기본 상태 보기 # pvs # vgs # lvs 2. 생성하기 (파티션lvm 으로 생성 후) 1) PV (Physical Volume) 생성 # pvcreate /dev/sda1 (pvcreate [파티션 이름]) 2) VG (Volume Group) 생성 # vgcreate datavg /dev/sda1 (vgcreate [볼륨그룹 이름] [물리볼륨1] [물리볼륨2]) 3) LV (Logical Volume) 생성 # lvcreate -n data -l 100%FREE datavg (lvcreate -n [논리볼륨 이름] -(L, l) [size] [볼륨그룹 이름]) (-L 은 KB,MB,GB,TB로 설정 -L 5GB와 같이, -l 은 %로 설정) 4) format 및 mount 후 사용 # mk..
[MAN] ip command Nameip - show / manipulate routing, devices, policy routing and tunnelsSynopsisip [ OPTIONS ] OBJECT { COMMAND | help }OBJECT := { link | addr | addrlabel | route | rule |neigh | tunnel | maddr | mroute | monitor }OPTIONS := { -V[ersion] | -s[tatistics] | -r[esolve] | -f[amily] { inet | inet6 | ipx | dnet | link } | -o[neline] }ip link set DEVICE { up | down | arp { on | off } | promisc { on | o..
/proc/sys/net/ipv4/* Variables: /proc/sys/net/ipv4/* Variables: ip_forward - BOOLEAN 0 - disabled (default) not 0 - enabled Forward Packets between interfaces. This variable is special, its change resets all configuration parameters to their default state (RFC1122 for hosts, RFC1812 for routers) ip_default_ttl - INTEGER Default value of TTL field (Time To Live) for outgoing (but not forwarded) IP packets. Should be between 1 a..
[shell] 특정 단어가 포함된 파일을 찾아 삭제하기 외 # grep "abc" * -iR | awk -F: '{print $1}' | sed "s/.*/rm -rf \0/" | shabc가 포함된 파일을 찾아 삭제한다. # find . -not -path "./folder/*" | xargs grep abc *grep 으로 abc를 찾는데 folder는 제외한다.
[Sendmail] mqueue 1. linux에서 sendmail을 통해 메일을 발송하면 일반적으로 /var/spool/mqueue 에 쌓아 놓고 발송한다.2. 발송한 메일이 정상 수신되지 않아 반송되거나 받는 메일주소가 정확치 않아 발송이 실패하면 mqueue 에 남는다.3. sendmail 설정에 따라 주기적으로 다시 보내다가 일정 시간이 지나면 최종적으로 발송 실패처리되고 삭제된다. 1) queuing 상황 보기# sendmail -bp 2) sendmail.cf 관련 설정# minimum time in queue before retry (30분마다 다시 보낸다. 기본은 주석처리) O MinQueueAge=30m# 5day 후에도 queue에 남아 있으면 삭제한다. O Timeout.queuereturn=5d# 최초 발신자에게 ..
[Ubuntu] runlevel Ubuntu 15.10을 설치했는데 /etc/inittab 이 보이지 않는다./etc/init/rc-sysinit.conf 도 보이지 않는다. 1. /etc/default/grub 파일을 열고2. GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" 을 GRUB_CMDLINE_LINUX_DEFAULT="quiet splash text" 등으로 변경 또는 GRUB_CMDLINE_LINUX_DEFAULT="" 비어있는 값에 추가 3. update-grub
Ubuntu Upgrade 1. 버전확인$ uname -mrs $ lsb_release -a Ubuntu Servers (Recommended)If you installed from 14.04 or 12.04 originally you will need to remove LTS upgrade restrictions. Replace Prompt=lts with Prompt=normal: sudo pico /etc/update-manager/release-upgradesInstall update-manager-core if it is not already installed:sudo apt-get install update-manager-coreLaunch the upgrade tool:do-release-upgradeFollow th..
rm: Argument list too long - Solution (펌) (펌) http://linuxconfig.org/bash-bin-rm-argument-list-too-long-solution -bash: /bin/rm: Argument list too long - SolutionContents[Hide]SymptomsSolution1. SymptomsThis error message appears when you try to remove, move or copy a long list of files. When using your shell a command can only accept a limited number of arguments. When the number of arguments supplied to the command exceeds the permitt..
[PHP] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted apache 에서 특정 페이지가 열리지 않는 경우, error_log를 보면 다음과 같은 문구가 있다. [error] [client 10.61.20.1] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted(tried to allocate 69457921 bytes) in Unknown on line 0 이 경우 php.ini 파일의 메모리가 기본 128MB로 되어 있는 제한 때문인데 다음과 같이 늘려준다. ; Maximum amount of memory a script may consume (128MB); http://php.net/memory-limit;memory_limit = 128Mmemory_limit = 1024M
file 정보 확인 [root@qahuni ~]# file -i a.txt a.txt: text/x-c++; charset=us-ascii[root@qahuni ~]# file a.csv a.csv: text/plain; charset=iso-8859-1[root@qahuni ~]#