Linux에서 root 패스워드를 잊어버렸을때 - single 모드로 패스워드 변경

Coumputer's/Linux 2010. 1. 22. 11:06


grub edit> module /vmlinuz-2.6.18-53.el5xen ro root=/dev/VolGroup00/LogVol00 single rhgb quiet
grub edit> kernel /vmlinuz-2.6.9-5.EL ro root=/dev/VolGroup00/LogVol00 rhgb quiet single

# 기본적으로  kernel 로 시작하는 라인이 있지만
# root=/dev 패스 디렉토리가 있는 라인이 우선이 됨

# /single ==> 옆과 같이 /를 붙여야 에러가 없다는(Tab Key) 메세지가 나오지만 /를 넣으면 싱글모드로 들어가 지지 않음...
# single 이나 숫자 1 문구만 넣어야 싱글모드 실행
# 뒤에 rhgb quiet 은 부팅 방식이 다르고 없어도 싱글 모드로 실행 됨




싱글 모드로 부팅을 하신후 passwd root로 패스워드를 변경하시면 될것 같습니다.



첫 번째! - GRUB 또는 부트 로더에서 "Single mode"로 들어가 암호를 변경할 수 있다.

  1. GRUB가 뜨면 해당 커널을 선택하고 ‘e’ (edit mode)로 들어간다.

  2. kernel=" ..." 줄을 선택하고 ‘e’를 눌러 해당 옵션을 수정해야 한다.
## root=/dev/VolGroup00/LogVol00 (1 또는 single)
// root= 뒷부분에 1 또는 single 를 넣어줌

  3. 맨 뒤에 “single” 또는 “1” 을 입력하고 esc 키(엔터는 기본입니다...^^)를 누르면

     옵션이 수정된 것을 확인할 수 있다.

  4. 그 이후 ‘b’ (booting)(엔터는 기본입니다...^^)를 누르면 싱글 모드로 부팅이 되고 비밀  

     번호 없이 root 계정으로 들어갈 수 있다.

  5. 그 이후에 패스워드를 입력하여 변경가능하다. root로 로그인이 된 상황이라도

     비밀번호는 없는 상태이기 때문이다.

출처 : http://develop.sunshiny.co.kr/88

openssl 인증서 만들기

Coumputer's/Linux 2009. 3. 31. 18:04


$ openssl genrsa -out ca.key

$ openssl req -new -key ca.key -out ca.csr
Country Name (2 letter code) [AU]:US
State or Province Name (full name) [Some-State]:
Locality Name (eg, city) []:
Organization Name (eg, company) [Internet Widgits Pty Ltd]:
Organizational Unit Name (eg, section) []:
Common Name (eg, YOUR name) []:bahdushka
Email Address []:

$ openssl x509 -req -days 3650 -in ca.csr -signkey ca.key -out ca.crt
Signature ok
subject=/C=US/ST=Some-State/O=Internet Widgits Pty Ltd/CN=bahdushka
Getting Private key

### now make a key that has a good cn just to make sure

$ openssl genrsa -out postgres.key

$ openssl req -new -key postgres.key -out postgres.csr
Country Name (2 letter code) [AU]:
State or Province Name (full name) [Some-State]:
Locality Name (eg, city) []:
Organization Name (eg, company) [Internet Widgits Pty Ltd]:
Organizational Unit Name (eg, section) []:
Common Name (eg, YOUR name) []:bahdushka
Email Address []:

$ openssl x509 -req -days 365 -CA ca.crt  -CAkey ca.key
-CAcreateserial -in postgres.csr -out postgres.crt
Signature ok
subject=/C=AU/ST=Some-State/O=Internet Widgits Pty Ltd/CN=bahdushka
Getting CA Private Key

$ cp ca.crt data/root.crt
$ cp ca.key data/root.key
$ cp postgres.crt data/server.crt
$ cp postgres.key data/server.key
$ rm ~/.postgresql/*

# restart postgres

$ SSLVERIFY=none ./psql junk -h bahdushka
psql: root certificate file (/home/alex/.postgresql/root.crt)

$ cp ca.crt ~/.postgresql/root.crt

$ SSLVERIFY=none ./psql junk -h bahdushka
psql (8.4devel)
Type "help" for help.

junk=#
LOG:  could not accept SSL connection: peer did not return a certificate

$ SSLVERIFY=cn ./psql junk -h bahdushka
psql (8.4devel)
Type "help" for help.

junk=#
LOG:  could not accept SSL connection: peer did not return a certificate

$ cp postgres.crt ~/.postgresql/postgresql.crt
$ cp postgres.key ~/.postgresql/postgresql.key
$ chmod 0600 ~/.postgresql/*

$ SSLVERIFY=cn ./psql junk -h 127.0.0.1
psql (8.4devel)
Type "help" for help.

junk=#
LOG:  could not receive data from client: Connection reset by peer

$ SSLVERIFY=cn ./psql junk -h bahdushka
psql (8.4devel)
SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)
Type "help" for help.

junk=#

### now make a crt that has a bad common name
$ openssl genrsa -out pg.key

$ openssl req -new -key pg.key -out pg.csr
Country Name (2 letter code) [AU]:US
State or Province Name (full name) [Some-State]:
Locality Name (eg, city) []:
Organization Name (eg, company) [Internet Widgits Pty Ltd]:
Organizational Unit Name (eg, section) []:
Common Name (eg, YOUR name) []:asdf
Email Address []:

$ openssl x509 -req -days 365 -CA ca.crt -CAkey ca.key -CAcreateserial
-in pg.csr -out pg.crt
Signature ok
subject=/C=US/ST=Some-State/O=Internet Widgits Pty Ltd/CN=asdf
Getting CA Private Key

$ cp pg.crt ~/.postgresql/postgresql.crt
$ cp pg.key ~/.postgresql/postgresql.key
$ chmod 0400 ~/.postgresql/*

$ SSLVERIFY=cn ./psql junk -h bahdushka
psql (8.4devel)
SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)
Type "help" for help.

junk=#

### ok no difference here must be the other way bad cn on the server

 

!!!! 윈도우는 root인증서도 필요하다.