'전체 글'에 해당되는 글 1435건

  1. 2008.10.10 CENTOS 5.2 mysql root 패스워드 분실시 복구방법
  2. 2008.10.10 netstat -s 명령어 옵션

반응형

리눅스에서는 대부분 mysql DB를 사용하게 되는 자주 로그인을 안한다든지 아니면 패스워드 입력시 잘못된 오타로 인하여 root 접속이 안될때는 난감한 경우가 있습니다..

이럴때 패스워드 복구 하는 방법이 있습니다..가장 먼저 할것은 우선 mysqld 데몬을 중지 시킵니다.
그런후에

# /usr/bin/mysqld_safe 를 먼저 찾는다.

다음과 같이 명령어를 적습니다.

[root@www bin]# ./mysqld_safe --skip-grant &

다음과 같이 데몬이 안전모드로 실행이 됩니다..

[root@www bin]# Starting mysqld daemon with databases from /var/lib/mysql

그런후에 아래와 같이 mysql 명령어를 입력하면 다음과 같이 패스워드 없이 접속이 됩니다.

[root@www bin]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.45 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use mysql;   --> db를 mysql로 바꾸어줍니다.
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed



그런다음 아래와 같은 명령어를 사용하면 새로운 패스워드가 업데이트 되는 것을 알수 있다.

mysql> update user set password=password('새로운 패스워드') where user='root';
Query OK, 3 rows affected (0.01 sec)
Rows matched: 3  Changed: 3  Warnings: 0


다시한번 mysql에 적용하기 위하여 아래와 같은 명령어를 적어 줍니다.

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> quit


그런후에 mysqld 데몬을 다시 정상적으로 start 시킨후 새로 업데이트 된 root 패스워드로 접속을 해 보면 접속이 가능합니다..

다시 말해서 조금 더 쉽게 말한다면 리눅스나 유닉스 등에서 시스템 권한이 이미 root 로 넘어 갔다고 한다면 누구도 db root 패스워드를 쉽게 바꿀수 있다는 이야기입니다.  mysql db 가 절대 안전하다고 할수 없다는 이야기가 되겠죠...

긴급하게 mysql  root 패스워드를 잊어버려 당황하여 안절 부절 못하는 경우가 있지만 보안에 대해서는 약간 취약 하다고 하겠습니다... 참고 하시기 바랍니다.

반응형
,

반응형

최근 DDoS 관련 하여 여러가지 자료 수집을 하고  공부를 하다보니 여러가지 네트워크에 대하여 다시 보게 된다.

그중에서 우리가 흔히 시스템에서 네트워크 현황을 보려고 할때 주로 사용하는 'netstat' 명령어 중에서 -s 옵션을 알게 되었다..

그냥 지나치게 되는 옵션인데 내용을 보니 아주 많은 부분을 볼수 있는 옵션이다.  특히 DDoS에 대한 기술적 대응시에는 많은 참조가 되겠다.

[root@www ~]# netstat -s
Ip:
    7782 total packets received
    0 forwarded
    0 incoming packets discarded

    4317 incoming packets delivered
    3341 requests sent out
Icmp:
    353 ICMP messages received
    0 input ICMP message failed.
    ICMP input histogram:
        destination unreachable: 326
        echo requests: 27
    404 ICMP messages sent
    0 ICMP messages failed
    ICMP output histogram:
        destination unreachable: 377
        echo replies: 27
IcmpMsg:
        InType3: 326
        InType8: 27
        OutType0: 27
        OutType3: 377
Tcp:
    2 active connections openings
    29 passive connection openings
    1 failed connection attempts
    1 connection resets received
    1 connections established
    2098 segments received
    2086 segments send out
    2 segments retransmited
    0 bad segments received.
    250 resets sent
Udp:
    53 packets received
    377 packets to unknown port received.
    0 packet receive errors
    379 packets sent
TcpExt:
    1 resets received for embryonic SYN_RECV sockets
    2 TCP sockets finished time wait in fast timer
    90 delayed acks sent
    Quick ack mode was activated 2 times
    29 packets directly queued to recvmsg prequeue.
    2 packets directly received from prequeue
    248 packets header predicted
    459 acknowledgments not containing data received
    140 predicted acknowledgments
    1 congestion windows recovered after partial ack
    0 TCP data loss events
    2 other TCP timeouts
    2 DSACKs sent for old packets
    1 DSACKs received
IpExt:
    InMcastPkts: 975
    OutMcastPkts: 515
    InBcastPkts: 506
[root@www ~]#

패킷과 ICMP,TCP,UDP등 왠만한 프로토콜에 대한 패킷수라든지, 컨넥션수등을 알수 있다.  간단한 명령어와 옵션을 가지고도 많은 정보를 알수 있다.  참고 하기 바랍니다..

반응형
,