Recover root password under linux with single user mode

By Huynh Sy Nguyen

Linux là một HĐH có tính bảo mật cao và ngày càng được sử dụng rộng rãi . Trong linux bạn có một account quyền cao nhất là root quyền này tương tự với account administrator bên Windown . Account này dung để cấu hình cho toàn hệ thống và nếu như bạn quên password của account root này thì quả thật rắc rối . Bạn phải tìm cách lấy lại password của account này và các bạn yên tâm khi các bạn ngồi trên máy đó thì có thể làm được bất cứ việc gì . Bài viết dưới sẽ giúp các bạn cách lấy lại account root cho mình
  • Nếu bạn dung GRUB
Bước 1 ) Reboot lại máy và chuyển sang chế độ single
- Đầu tiên khi bạn vừa reboot lại thì bạn bấm phím Tab để hiện ra bảng GNU GRUB
 

- Tiếp theo bạn bấm phím ‘e sau đó bấm enter
- Tiếp theo bạn chọn initrd /initrd-2.6.9-11.EL.img và sau đó bấm phím ‘e
 

-Tiếp theo bạn gõ lệnh : -s hoặc single (Tùy thuộc vào HĐH) ở bản này thì là -s
 

- Tiếp theo bạn bấm ‘b để reboot lại
Bước 2) Change password root trong single
Sau bạn reboot lại thì máy sẽ chuyển sang chế độ single mod và trong đây bạn sẽ reset lại password của root
Các bạn đánh các lệnh như ở hình dưới
 

Sauk hi reboot lại bạn đăng nhập với account root với password mới reset lại.
  • Nếu bạn dung LILO
Đối với cái này bạn cũng làm tương tự như GRUB . Chỉ khác lúc đầu vừa khởi động vào màn hình đồ họa đầu tiên bạn bấm "ctrl X" sau đó nó sẽ hiện ra dấu nhắc cho mình đánh dòng lệnh vào và mình đánh dòng lệnh "linux single" để vào chế độ single và sau đó bạn reset lại password tương tự trên

More...

Solaris 10 (x86-32) Installation

By Huynh Sy Nguyen

This article provides a pictorial guide for performing a default installation of Solaris 10 (x86-32). The installation is reasonably straight forward but it is not as simple and takes significantly longer than most modern Linux installations.

Note. At the time of writing Oracle Database 10g Release 2 for Solaris (x86-32) is not available!

  1. Boot from the DVD. At the GRUB screen press the "Enter" key or wait for the timeout period.

    Grub

  2. Wait while the Solaris installer boots. This can take quite a long time so don t panic.

    Boot

  3. Select the installation type. This installation is based on the default "Solaris Interactive" installation.

    Installation Type

  4. Accept the detected configuration by pressing the "Enter" key or alter it as appropriate.

    Configuration

    Once the configuration is accepted the rest of the installation is done from within an "X" session.

  5. Select the appropriate language for the installation.

    Language

  6. On the "Welcome" screen click the "Next >" button.

    Welcome

  7. On the "Network Connectivity" screen select the "Networked" option and click the "Next >" button.

    Network Connectivity

  8. Select the appropriate DHCP option and click the "Next >" button. In this case I chose not to use DHCP so the following screens allow are used to set the relevant network information.

    DHCP

  9. Enter the appropriate "Host Name" for the network interface and click the "Next >" button.

    Hostname

  10. Enter the appropriate "IP Address" for the network interface and click the "Next >" button.

    IP Address

  11. Enter the appropriate "Netmask" for the network interface and click the "Next >" button.

    Netmask

  12. Decide whether "IPv6" should be enabled on the network interface and click the "Next >" button.

    IPv6

  13. Decide whether to set a "Default Router" for the network interface and click the "Next >" button. I chose to specify my router manually.

    Default Router

  14. If you chose to set a "Default Router" enter the router "IP Address" and click the "Next >" button.

    Default Router Again

  15. Decide whether to set a "Kerberos" for the network interface and click the "Next >" button.

    Kerberos

  16. Specify a "Name Server" to be used with the installation if required.

    Name Service

  17. Specify how the "Timezone" should be configured on the server and click the "Next >" button. I used the "Continent And Country" option.

    TimeZone

  18. Select the appropriate time zone and click the "Next >" button.

    Continent And Country

  19. Adjust the date-time settings if necessary and click the "Next >" button.

    DateTime

  20. Enter the root password for the server and click the "Next >" button.

    Root Password

  21. The "Confirm Information" screen allows you to review the information entered so far. If it is correct click the "Confirm" button.

    Confirmation

  22. Click the "Next >" button on the "Welcome" screen.

    Welcome

  23. On the "Installer Options" screen click the "Next >" button.

    Installer Options

  24. Click the "OK" button on the "Notice" dialog.

    Notice

  25. Select the type of installation media and click the "Next >" button. In this case I was installing from a DVD.

    Specify Media

  26. Wait while the installation initializes.

    Initializing

  27. Accept the license agreement and click the "Next >" button.

    License

  28. Select the default installation and click the "Next >" button. Alternatively customize your installation and disk partitions.

    Install Type

  29. At the "Ready to Install" dialog and click the "Install Now" button.

    Ready To Install

  30. Wait while the installation completes. This took an absolute age so I ended up leaving it overnight.

    Installer

    Once the installation is complete the system reboots.

  31. Accept the default NFS configuration.

    NFS

  32. Log in as the "root" user using the password you specified during the installation.

    Login

  33. Select the desired desktop. I chose the "Java Desktop System" option as it uses a Gnome desktop which is a little more pleasing to they eye than the Common Desktop Environment (CDE).

    Desktop Selection

  34. Close the welcome spash screen.

    Desktop Startup

  35. You have now completed the installation and have a functional Gnome desktop.

More...

Networking on Solaris 10

By Huynh Sy Nguyen

More...

Installing Sun Solaris 10

By Huynh Sy Nguyen

Installing Sun Solaris 10

by Jeff Hunter Sr. Database Administrator

 


 

Contents

 

  1. Overview
  2. Using Serial Console Connection
  3. Starting the Installation
  4. Answering the Screen Prompts
  5. Post-Installation Tasks

 

 


 

Overview

 

This article documents installing the 6/06 (June 2006) release of Solaris 10 from CD-ROM. For the purpose of this example I will be installing Solaris 10 on a Sun Blade 150 with the following configuration:

 

  • Sun Blade 150 (UltraSPARC-IIe 650MHz) No Keyboard OpenBoot 4.6
  • 1 792 MB RAM Memory
  • Two - 40 GB IDE Western Digital Hard Drives - (/dev/dsk/c0t0d0 and /dev/dsk/c0t2d0)
  • Built-in Ethernet - (eri0)
  • CDROM - (/dev/dsk/c0t1d0)

Installing Solaris 10 will require 5 CDs found in the Solaris media kit labeled "Solaris 10 Software" or downloaded from http://www.sun.com/software/solaris/ - (Solaris 10 6/06). Before starting the installation process ensure that you have noted the following items:

 

  • Determine the host name of the system you are installing
  • Determine the language and locales you intend to use on the system
  • If you intend to include the system in a network gather the following information:
    • Host IP address
    • Subnet mask
    • Type of name service (DNS NIS or NIS+ for example)
    • Domain name
    • Host name of server
    • Host IP address of the name server

Using Serial / Console Connection

 

For a complete discussion of connecting to a Sun serial console from Linux see my article "Using Serial Consoles - (Sun Sparcs)".

For this particular installation I will NOT be using a VGA monitor connected to the built-in frame-buffer (video card). The installation will be done using the serial port of the Sun Blade as a console. A serial cable (null modem) will be connected from the serial port of a Linux machine to the serial port of the Sun Blade. Keep in mind that you will not be able to make use of the serial console of the Sun Blade if it was booted with the keyboard/mouse plugged in. In order to make use of the serial console you will need to disconnect the keyboard/mouse and reboot the Sun server. On the Sun Blade 100/150 if the keyboard/mouse are plugged in during the boot phase all console output will be redirected to the VGA console.

From the Linux machine you can use a program called minicom. Start it up with the command "minicom". Press "Ctrl-A Z" to get to the main menu. Press "o" to configure minicom. Go to "Serial port setup" and make sure that you are set to the correct "Serial Device" and that the speed on line E matches the speed of the serial console you are connecting to. (In most cases with Sun this is 9600.) Here are the settings I made when using Serial A / COM1 port on the Linux machine:

+-----------------------------------------------------------------------+
| A - Serial Device : /dev/ttyS0 |
| B - Lockfile Location : /var/lock |
| C - Callin Program : |
| D - Callout Program : |
| E - Bps/Par/Bits : 9600 8N1 |
| F - Hardware Flow Control : Yes |
| G - Software Flow Control : No |
| |
| Change which setting? |
+-----------------------------------------------------------------------+
After making all necessary changes hit the ESC key to go back to the "configurations" menu. Now go to "Modem and dialing". Change the "Init string" to "~^M~". Save the settings (as dflt) and then restart Minicom. You should now see a console login prompt.

 

[root@bertha1 root]# minicom

Welcome to minicom 2.00.0

OPTIONS: History Buffer F-key Macros Search History Buffer I18n
Compiled on Feb 17 2004 04:52:10.

Press CTRL-A Z for help on special keys

alex console login: root
Password:
Last login: Tue Nov 4 18:55:41 on console
Nov 7 12:17:24 alex login: ROOT LOGIN /dev/console
Sun Microsystems Inc. SunOS 5.8 Generic Patch October 2001
#
# init 0
INIT: New run level: 0
The system is coming down. Please wait.
System services are now being stopped.
Print services stopped.
Nov 7 12:17:38 alex syslogd: going down on signal 15
The system is down.
syncing file systems... done
Program terminated
ok

Starting the Installation

 

The installation process starts at the ok prompt. The previous section of this document provides the steps required to not only gain access to the console port of the Sun SPARC server but also how to get the server to an ok prompt. If when logging on the machine is already booted into the O/S (you have a console login like the following: "alex console login:") you will need to bring the machine to its EEPROM (ok prompt) by initiating init 0 like in the Using Serial / Console Connection section above.

The first step in installing Solaris 10 is to boot the machine from Disk 1 of the Solaris 10 Software CDs. You will need to get the machine to the ok prompt. You can do this by shutting the system down using init 0. Once at the ok prompt type in boot cdrom. (Or in some cases you can use reboot cdrom). From here the installation program prompts you for system configuration information that is needed to complete the installation.

 

  If you were performing a network installation you would type:
ok boot net

In almost all cases you will be installing the Solaris 10 software on a new system where it will not be necessary to preserve any data already on the hard drive. Using this assumption I will partition the first single 40 GB IDE hard drive (/dev/dsk/c0t0d0) as the system disk.

Answering the Screen Prompts

 

Let s start the installation process! Put the Solaris 10 Software (Disk 1 of 5) in the CDROM tray and boot to it:

 

Solaris Installation Boot Screen
ok boot cdrom
Resetting ...


Sun Blade 150 (UltraSPARC-IIe 650MHz) No Keyboard
Copyright 1998-2002 Sun Microsystems Inc. All rights reserved.
OpenBoot 4.6 1792 MB memory installed Serial #52928138.
Ethernet address 0:3:ba:27:9e:8a Host ID: 83279e8a.


Rebooting with command: boot cdrom
Boot device: /pci@1f 0/ide@d/cdrom@1 0:f File and args:
SunOS Release 5.10 Version Generic_118833-17 64-bit
Copyright 1983-2005 Sun Microsystems Inc. All rights reserved.
Use is subject to license terms.
Configuring devices.
Using RPC Bootparams for network configuration information.
Attempting to configure interface eri0...
SUNW eri0 : 100 Mbps full duplex link up
Configured interface eri0
Beginning system identification...
Searching for configuration file(s)...
Search complete.
Discovering additional network configuration...

The boot process may take several minutes to complete but once done you will start answering a series of prompts.

The following section will walk you through many of the screen prompts from the installation.

The first two prompts are from the command line interface (CLI) and are used to specify the language and terminal. Use English for the Language. As for a terminal setting I commonly telnet to a Linux server (that is connected from the serial port of the Linux server to the serial port of the Sun machine). From the Linux server I use "minicom" to connect from the Linux server to the Sun server. The best terminal for this type of installation is "DEC VT100":

 

  Language                             : English
What type of terminal are you using? : 3) DEC VT100

 

  You should be able to use a terminal type of "DEC VT100" or "X Terminal Emulator (xterms)".

 

 

  Depending on the terminal being used for installation while using the command line interface it may be required to precede any of the function key responses (i.e. F2_Continue) with the ESC key (i.e. ESC - F2_Continue). For the purpose of this installation I am using minicom 2.0 and configured the installation to use a DEC VT100 terminal. Given this configuration I did not have to precede any of the function key responses with the ESC key.

 

Many of the screens to follow will ask you about networking information. When asked if the system will be connected to a network answer Yes.

 

 

  Many of the screens should be easy to complete except for the "Names Services" section. In almost all cases you will want to use DNS naming services but if your machine is not currently configured within DNS this section will fail and no information entered about Names Services will be stored and configured.

If this is the case you will need to select None under the Names Services section. The network configuration will then need to be completed after the installation process by updating certain network files on the local hard drive. This will be documented in the "Post Installation Procedures" of this document.

 

 



Screen 1 : The Solaris Installation Program

This is the Solaris Installation Welcome screen.

Hit F2 to continue


Screen 2 : Identify This System

This screen informs you about how you will need to identify the computer as it applies to network connectivity.

Hit F2 to continue


Screen 3 : Network Connectivity

 

Networked
---------
[X] Yes
[ ] No
Hit F2 to continue


Screen 4 : DHCP

 

Use DHCP
--------
[ ] Yes
[X] No
Hit F2 to continue


Screen 5 : Host Name for eri0

Enter the host name which will identify this system on the network. For the purpose of this example I will use the host name "alex".

Host name for eri0: alex
Hit F2 to continue


Screen 6 : IP Address for eri0

Enter the Internet Protocol (IP) address for this network interface.

IP address for eri0: 192.168.1.102
Hit F2 to continue


Screen 7 : Subnet for eri0

More...