본문 바로가기
반응형

Linux91

lsof 명령어 - 해킹추적 lsof 명령어 사용 lsof -i // 모든 네트워크 연결되어 있는 프로세스와 파일을 정보를 보여준다. # lsof -i sshd 586 root 3u IPv4 1877 TCP *:ssh (LISTEN) xinetd 600 root 5u IPv4 1943 TCP *:pop3 (LISTEN) sendmail 619 root 4u IPv4 1962 TCP *:smtp (LISTEN) proftpd 647 nobody 0u IPv4 315947 TCP *:ftp (LISTEN) mysqld 708 mysql 3u IPv4 2652 TCP *:mysql (LISTEN) ex)lsof -iTCP ; lsof -iUDP tcp 나 혹은 UDP를 걸러서 볼때 사용한다. lsof 파일명 // 지정한 파일을 엑세스 하.. 2018. 2. 21.
netstat, lsof, nmap 열려 있는 모든 포트 확인 netstat, lsof 열려 있는 모든 포트확인 // 열려 있는 모든 포트확인 netstat -nap // LISTEN 되 는 모든 포트 netstat -l netstat -nap | grep LISTEN // 모든 서비스 동시 접속자 수 netstat -nap | grep ESTABLISHED | wc -l // 웹 동시 접속자 수 netstat -nap | grep :80 | grep ESTABLISHED | wc -l // 특정포트가 사용하는 프로세스 확인 1) netstat -nap 로 포트를 확인 tcp 0 96 59.11.109.103:9765 120.124.182.193:9899 ESTABLISHED 8172/sshd 2) ps -ef | grep 8172 명령으로 확인 root 8172 .. 2018. 2. 21.
/lib/ld-linux.so.2: bad ELF interpreter: 그런 파일이나 디렉터리가 없습니다 리눅스 /lib/ld-linux.so.2: bad ELF interpreter 오류 구형 cgi 프로그램을 시작하는데 오류가 난다. ./test.cgi -bash: ./test.cgi: /lib/ld-linux.so.2: bad ELF interpreter: 그런 파일이나 디렉터리가 없습니다 추가 설치를 해준다. yum install compat-glibc yum install libstdc++*i686* 2018. 2. 6.
리눅스 euc-kr 파일을 utf-8로 변환, 또는 반대로 변환 리눅스 euc-kr 파일을 utf-8로 변환 convmv 는 사용중인 파일명의 인코딩을 변환해 주는 툴입니다. 1. convmv 설치Shell1[root@localhost ~]# yum install convmvCentOS 6.x 에서 convmv 미지원시 rpmfine.net 사이트에서 다운받아 설치 합니다.Shell12[root@localhost ~]# ftp://rpmfind.net/linux/centos/5.10/os/x86_64/CentOS/convmv-1.10-1.el5.noarch.rpm[root@localhost ~]# rpm -ivh convmv-1.10-1.el5.noarch.rpm 2. convmv 사용Shell1[root@localhost ~]# convmv --notest --no.. 2018. 1. 19.
centos에서 vsftpd + mysql 사용 centos에서 vsftpd + mysql 사용 CentOS 에서 자주 사용되는 FTP 서버인 Vsftpd 의 virtual user 기능을 pam 를 통한 mysql DB 를 이용하여 사용하는 방법에 대한 설명입니다.Vsftpd 용 계정 추가 및 가상 사용자 디렉토리 생성Vsftpd 가 사용할 계정은 vsftpd 로 가정하고 추가합니다.> useradd vsftpd > passwd vsftpd가상 사용자가 사용할 디렉토리는 vsftpd 에 users 디렉토리를 사용한다고 가정합니다. 가상 사용자를 user1 이라고 가정하고 가상 사용자의 홈 디렉토리까지 만들어 줍니다.> mkdir /home/vsftpd/users > mkdir /home/vsftpd/users/user1Mysql Server 설치가상.. 2018. 1. 18.
네임서버 설치 bind 설치 및 설정 (dns) 1. rpm 설치 yum install bind bind-* 2. /etc/named.conf 수정 options { listen-on port 53 { any; }; listen-on-v6 port 53 { ::1; }; directory "/var/named"; dump-file "/var/named/data/cache_dump.db"; statistics-file "/var/named/data/named_stats.txt"; memstatistics-file "/var/named/data/named_mem_stats.txt"; allow-query { any; }; allow-transfer { 127.0.0.1;1.234.27.103;59.1.209.94; }; recursion no; versi.. 2018. 1. 14.
원격호스트에서 ssh 세션을 이용한 rsync 명령으로 파일/디렉토리 복사 원격호스트에서 ssh 세션을 이용한 rsync 명령으로 파일/디렉토리 복사 예) rsync -r -v -u -z --delete -e "ssh -p 22" ~/my_dir john@my_server.net:/home/john/my_backup 예) [root@localhost test]# rsync -v -u -a --delete --rsh=ssh --stats root@172.28.71.45:/home/student1 . root@172.28.71.45's password: receiving file list ... done student1/ student1/.bash_logout student1/.bash_profile student1/.bashrc student1/test.txt student1/... 2018. 1. 14.
Superblock 손상을 입었을 경우 복구 방법 http://docs.sun.com/app/docs/doc/805-7228/6j6q7uf0i?a=view When the superblock of a file system becomes damaged, you must restore it. fsck tells you when a superblock is bad. Fortunately, redundant copies of the superblock are stored within a file system. You can use fsck -o b to replace the superblock with one of the copies. How to Restore a Bad Superblock 1. Become superuser. 2. Change to a di.. 2018. 1. 14.
Fail2ban을 이용한 Brute Force 공격 막기 Fail2ban을 이용한 Brute Force 공격 막기 1. yum으로 패키지 설치 yum install fail2ban 2. 설정 파일 구성 vi /etc/fail2ban/jail.conf ----------//--------- [DEFAULT] # "ignoreip" can be an IP address, a CIDR mask or a DNS host. Fail2ban will not # ban a host which matches an address in this list. Several addresses can be # defined using space separator. ignoreip = 127.0.0.1 2018. 1. 14.
awk 명령어 awk 명령어 awk '/west/' datafile : west 라는 글이 있는 줄 출력 awk '/^north/' datafile : north로 시작하는 줄 출력 awk '/^(no | so)/' datafile : no 또는 so 로 시작하는 줄 출력 awk '{ print $3, $2 }' datafile : datafile 리스트의 세 번째 와 두 번째 필드를 스페이스로 띄어서 출력 awk '{ print $3 $2 }' datafile : datafile 리스트의 세 번째 와 두 번째 필드를 그냥 붙여서 출력 awk '{ print "Number of fields : " NF} ' datafile : datafile의 각 줄마다의 필드수를 리턴한다. awk '$5 ~ /\.[7-9]+/' d.. 2018. 1. 14.
리눅스 시스템 모니터링 툴 20가지 리눅스 시스템 모니터링 툴 20가지 from: http://www.cyberciti.biz/tips/top-linux-monitoring-tools.html Need to monitor Linux server performance? Try these built-in command and a few add-on tools. Most Linux distributions are equipped with tons of monitoring. These tools provide metrics which can be used to get information about system activities. You can use these tools to find the possible causes of a perform.. 2018. 1. 14.
쉘 스크립트 (Shell Script) 쉘 스크립트 (Shell Script) - (Ⅰ) 어떤 것이 쉘 스크립트? 우리는 알게 모르게 많은 쉘 스크립트을 사용한다. 그렇다면 어떤 것이 쉘스크립트인가? 확인을 해보는 방법은 file와 grep명령을 사용해서 찾아보는 것이다. 필자의 시스템에서의 결과는 다음과 같다. $ (cd /bin ; file * |grep “shell script”) false : Bourne shell script text igawk : Bourne shell script text remadmin : Bourne shell script text true : Bourne shell script text $ (cd /usr/bin ; file * |grep “shell script”) anytopnm : Bourne shel.. 2018. 1. 14.
반응형