본문 바로가기

Linux

GRUB (GRand Unified Bootloader)

Grub 설정파일


/boot/grub/grub.conf : 원본 파일
/etc/grub.conf
# vi /boot/grub/grub.conf

---------------------- grub설정 파일내용------------------------

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/sda2
#          initrd /initrd-version.img
# boot=/dev/sda
default=0   - 멀티 부팅인 경우 기본으로 부팅할 OS의 LABEL번호(기본값 0) 선택
timeout=5  
splashimage=(hd0,0)/grub/splash.xpm.gz - grub의 배경이미지 설정
hiddenmenu
title CentOS (2.6.18-92.el5)      - 설치된 OS로 grub메뉴에 나타나는 OS의 이름 설정
        root (hd0,0)                   - OS가 설치된 파티션을 설정
        kernel /vmlinuz-2.6.18-92.el5 ro root=LABEL=/ rhgb quiet        - /boot폴더에 있음, 커널정보임, ro=read-only
        initrd /initrd-2.6.18-92.el5.img
title Windows XP                   - 설치된 OS로 grub메뉴에 나타나는 OS의 이름 설정
        rootnoverify (hd0,1)       - 윈도우로 부팅할 경우 설정
        chainloader +1

------------------------------------------------------------------------------------------------------------------------

Grub 패스워드 설정



X-window로 설정

# grub-md5-crypt
Password:
Retype password:
$1$aAMwm$YYOV/bSFos8xMYwAxZpZN. - 암호화된 패스워드

# vi /boot/grub/grub.conf
---------------------------------------------------------------------------------------
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/sda2
#          initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=5
password --md5 $1$aAMwm$YYOV/bSFos8xMYwAxZpZN. - 패스워드 부분을 추가한다.
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-92.el5)
      root (hd0,0)
      kernel /vmlinuz-2.6.18-92.el5 ro root=LABEL=/root rhgb quiet
      initrd /initrd-2.6.18-92.el5.img
----------------------------------------------------------------------------------------

리부팅을 하고 Grub으로 들어가게 되면 기존의 Grub모드는 없어지고 'p (패스워드)' 만 남게 되는데
이때 'p'를 입력하고 패스워드를 입력하게 되면 Grub모드로 진입이 가능해 진다.

또는

리눅스 설치 CD 1번을 넣고 rescue모드로 진입 후 위 내용의 패스워드 부분을 삭제하면 해결이 가능하다.


콘솔모드로 설정

# grub-md5-crypt > pass.txt 
- 비밀번호를 pass.txt 파일에 저장한다.
이때 화면에는 아무런 표시가 일어나지 않게 되는데 암호 입력과 암호 확인으로 인해 두번 입력하면 된다.


# cat pass.txt   - 비밀번호가 잘 입력 되었는지 확인한다.

# vim /etc/grub.conf
- 화면 분할 기능을 사용하기 위해 vim 명령어를 사용한다.

명령모드에서 화면분할 (ctrl + w, n) 후 위쪽 화면에 확장모드에서 :e pass.txt (또는 경로와 파일) 파일을 불러온다.

파일을 불러온후 암호위치에서 yy (명령모드) 로 복사한 후 ctrl + w, w 로 아래로 이동한다.

파일이동후 timeout 아래에 p (명령모드) 로 복사한 내용을 붙여넣고 저장하고 vi 편집기를 종료하면 된다.

'Linux' 카테고리의 다른 글

리눅스 백업 - rsync  (0) 2008.11.17
리눅스 백업 - dump & disk dump  (1) 2008.11.17
리눅스 압축  (0) 2008.11.17
부트로더  (0) 2008.11.17
데몬 (Daemon)  (0) 2008.11.17
YUM  (0) 2008.11.14