Author Topic: Forgotten root Password  (Read 4128 times)

0 Members and 1 Guest are viewing this topic.

Forgotten root Password
« on: July 27, 2011, 02:07:04 PM »

Offline Nick

  • Administrator
  • Platinum Member
  • *
  • Posts: 46027
  • Karma: +1000/-0
  • Gender: Male
  • NickCS
    • http://www.facebook.com/nickcomputerservices
    • http://www.twitter.com/nickcomputer
    • Computer Chiangmai

Forgotten root Password

Help! I forgot my root password. How do I log in now?

You can log in using single-user mode and create a new root password.

To enter single-user mode, reboot your computer. If you use the default boot loader, GRUB, you can enter single user mode by performing the following:

1. At the boot loader menu, use the arrow keys to highlight the installation you want to edit and type [A] to enter into append mode.

2. You are presented with a prompt that looks similar to the following:

grub append> ro root=LABEL=/

3. Press the Spacebar once to add a blank space, then add the word single to tell GRUB to boot into single-user Linux mode. The result should look like the following:

ro root=LABEL=/ single

4. Press [Enter] and GRUB will boot single-user Linux mode. After it finishes loading, you will be presented with a shell prompt similar to the following:

sh-2.05b#

5. You can now change the root password by typing

passwd root

You will be asked to re-type the password for verification. Once you are finished, the password will be changed. You can then reboot by typing reboot at the prompt; then you can log in to root as you normally would.

==================================


ลืมรหัสผ่านของ root

: วิธีนี้ใช้ได้ใน Redhat version 6.2 แน่นอน แต่รุ่นอื่นก็มีวิธีต่างกันไปบ้างเล็กน้อย
ผมทราบวิธีนี้เพราะเข้าไปดูที่ redhat.com ในส่วนของ FAQ และที่ต้องเข้าไปดูก็เพราะมี hacker จาก 193.231.178.98 เข้ามาด้วย operator account แล้วเปลี่ยนรหัสผ่านของ root ไป ทำให้ผมไม่สามารถเข้าไปสร้างผู้ใช้ใหม่ได้ ถามหลาย ๆ ท่านก็บอกให้ใช้แผ่นบูต แบบ linux rescue ผมก็เข้าไป จะ mount จะอะไรก็ไม่ได้ อาจเป็นเพราะยังไม่ชำนาญ แต่วิธีการเรียกรหัสผ่านของ root คืนในแบบที่ผมได้มานี้ ง่ายกว่าวิธีใด ๆ แน่นอน แต่ต้องทำที่ Console


ขั้นตอนสำหรับ LILO

-เมื่อ Restart เครื่อง ก่อนเข้าระบบ ให้กด Alt-X ขณะที่อยู่ที่ LILO prompt แล้วพิมพ์ว่า linux single
-เมื่อเข้าไปจะได้สถานะเป็น root ทันที ก็เพียงแต่ใช้คำสั่ง passwd root แล้ว reboot ก็เรียบร้อยแล้ว
-ขั้นตอนสำหรับ GRUB
-เมื่อ Restart เครื่อง ก่อนเข้าระบบขณะที่อยู่ที่ GRUB prompt ให้กด e
-พบ Fedora กด e แล้วพบ Kernel กด e แล้วพิมพ์ single ต่อท้ายคำสั่งที่ใช้ boot ระบบ
-ออกมาแล้วกด b เพื่อ boot ตามคำสั่งที่แก้ไขนั้น ก็จะเข้า #
-เมื่อเข้าไปจะได้สถานะเป็น root ทันที ก็เพียงแต่ใช้คำสั่ง passwd root เพื่อเปลี่ยนรหัสผ่าน แล้ว reboot ก็เรียบร้อยแล้ว

สำหรับเครื่อง Sun
-ซึ่งเป็น Unix server ที่ดี จะใช้การ Reboot และกดปุ่ม stop a แล้วใช้คำสั่ง boot -s

==============================================

วิธีแก้ password ใน redhat 9

-ทำการ boot แผ่นที่ 1 ขึ้นมา แล้วกด F5

boot : linux rescue

-จากนั้นก็ set ค่าที่แสดงขึ้นมา จนถึงเครื่องหมาย #

sh-3.00# chroot /mnt/sysimage

sh-3.00# passwd root

New UNIX password : <>

Retype new UNIX password : <>

-ถึงขั้นตอนนี้ก็สามารถเปลี่ยน password ได้แล้ว



วิธีแก้ password ใน fedora core 3

-วิธีนี้ไม่จำเป็นต้องใช้แผ่น boot

-พอเริ่มทำการ boot linux ให้กด a

-grub append / ro root = LABLE = / rhgb guiet 1 <<<--- พิมพ์ 1 เพิ่มเข้าไป เพื่อให้ boot แบบ single mode

-sh-3.00# passwd root

New UNIX password : <>

Retype new UNIX password : <>

-ถึงขั้นตอนนี้ก็สามารถเปลี่ยน password ได้เช่นกัน


*** Alternatives (by Yoshijo)

Fedora Core 3

-ใส่ Fedora Core 3 Disc 1 แล้ว boot เครื่องให้เริ่มจาก CD

-ให้พิมพ์ที่ prompt ของ Fedora Installer Wizard ว่า linux-rescue (F5)

-ทำตามขั้นตอนต่างๆ ที่กำหนด

sh-3.00# vi /chroot/etc/shadow

-จากนั้น ลบ Password ของ root ออก และ ทำการ save ( พิมพ์ :wq ที่ global vi command mode)

-จากนั้น กด CTRL+ALT+DEL เพื่อ reboot

-เมื่อบูทถึงหน้า Login ให้ login เป็น root โดยไม่ต้องใส่ paasword

[root@localhost]#passwd

New UNIX password : <>

Retype new UNIX password : <>

-ถึงขั้นตอนนี้ก็สามารถเปลี่ยน password ได้เช่นกัน



วิธีแก้ password ใน Slackware (หรือ Distro อื่นๆ ที่ใช้ Boot Loader เป็น LILO)

-เมื่อ Restart เครื่อง ก่อนเข้าระบบ ให้กด Alt-X ขณะอยู่ที่ LILO prompt แล้วพิมพ์ว่า linux single เมื่อเข้าไปจะได้สถานะเป็น root ทันที ก็เพียงแต่ใช้คำสั่ง passwd root แล้ว reboot

-เพิ่มเติมให้แล้วกัน อิอิ กรณีไม่มีแผ่นบูต

-ใน Red Hat Family ในหน้า Grub ที่จะแสดง os ในเครื่องนั้น ให้เลือกไปที่ Linux ... และกดปุ่ม e จะสามารถเข้าไป Edit ให้เลือกบรรทัดไปที่ ส่วนของ linux จากนั้นให้กด e อีกครั้งจะสามารถ edit ข้อมูลบรรทัดนั้น ๆ ได้ ให้ เลื่อนไปสุดบรรทัด และพิมพ์ s

-ทำสัก 2 บรรทัด ของ linux อะ จะออกมาเป็น
root (hd0,0) s
kernal /vmlinuz-2.6.9-42.EL ro root=LABEL=/ rhgb quiet s

-ตรง s ของทั้งสองบรรทัดเนี้ย เพิ่มมาทีหลัง จากนั้นกดที่ปุ่ม b จะเป็นการ reboot
-เมื่อ boot มาใหม่จะเข้าสู่ single mode ซึ่งก็ทำการแก้ไขรหัส ด้วยคำสั่ง
passwd ได้เลย จะใส่ root หรือไม่ก็ได้ เพราะ หากเราพิมพ์คำสั่ง passwd เฉย ๆ ระบบจะรู้เองว่าเราต้องการแก้ไข password ของ root ครับผม

ปล.ข้อนี้เป็นข้อแรกของการสอบ RHCE นะครับ ไม่มีแผ่นบูตให้นะ อิอิ
ยังไงจะไปสอบก็อย่าตกม้าตายในข้อนี้นะ เอามาบอกแว้วอะ

อ๋อเพิ่มเติม เมื่อ reboot ครั้งต่อไปก็จะ boot อย่างปกตินะ ระบบจะตัว s ออกให้เองโดยอัตโนมัติ


 
Share this topic...
In a forum
(BBCode)
In a site/blog
(HTML)


Related Topics

  Subject / Started by Replies Last post
0 Replies
4556 Views
Last post February 14, 2009, 08:16:46 PM
by Webmaster
2 Replies
6252 Views
Last post August 28, 2009, 06:41:30 PM
by IT
0 Replies
2988 Views
Last post August 10, 2010, 01:33:04 AM
by Nick
0 Replies
3331 Views
Last post September 25, 2010, 02:34:11 PM
by Nick
0 Replies
4086 Views
Last post November 10, 2010, 04:45:29 PM
by Nick
0 Replies
1243 Views
Last post February 16, 2012, 03:36:11 PM
by Nick
0 Replies
1267 Views
Last post April 26, 2012, 05:47:31 PM
by Nick
0 Replies
1831 Views
Last post November 18, 2012, 04:50:17 PM
by Nick
0 Replies
1101 Views
Last post April 04, 2013, 03:42:57 PM
by Nick
0 Replies
4361 Views
Last post April 04, 2013, 04:37:00 PM
by Nick