<page xmlns="http://projectmallard.org/1.0/"
      type="topic" style="problem"
      id="user-forgottenpassword">

  <info>
    <link type="guide" xref="user-accounts#passwords"/>
    <desc>Advanced techniques for resetting your password.</desc>
    <revision pkgversion="3.0" date="2011-02-22" status="final"/>
    <revision pkgversion="3.0" version="3.0.1" date="2011-04-15" status="incomplete"/>
    <credit type="author">
      <name>GNOME Documentation Project</name>
      <email>gnome-doc-list@gnome.org</email>
    </credit>

    <include href="legal.xml" xmlns="http://www.w3.org/2001/XInclude"/>
  </info>

  <title>I forgot my password!</title>

<comment><cite date="2011-06-07">mimico</cite><p>These instructions were written and tested using gnome3 from ppa.  I attempted following them on Fedora15 and locked the system out completely (had to reinstall os).  There is still hope, but getting this page accurate and safe (so users don't completely lock themselves out) will be very time consuming.  Perhaps distro specific pages are needed for this topic?</p></comment>

<comment><cite date="2011-04-03">shaunm</cite><p>Marking final for 3.0.
This could use some work for 3.2. There are some less drastic things.
Like if there's another admin user on your computer, have them reset
your password in the user accounts settings.</p>
<p>Also: merge two grubs instructions (almost equal), use clicky-clicky
instructions as much as possible, and let's get some real keyring docs
integrated in gnome-help then link there.</p>
</comment>
  <p>
     It is important to choose not only<link xref="user-goodpassword">a good
 and secure password</link>, but also one that you can remember. If you have
 forgotten the password to log in to your computer account, you can follow the
 following steps to reset it.
  </p>
  <note style="important">
  <p>
     If you have an encrypted home directory, you will not be able to reset a
 forgotten password.
  </p>
  </note>
  <p>
  If you simply want to change your password, see <link xref="user-changepassword"/>.
  </p>

  <links type="section"/>

  <section id="reset-password-grub2"><title>Reset password on <app>Grub2</app>
 systems</title>
           <note>
           <p>These steps will work for <app>Grub2</app>. If you are still
 running the older version of <app>Grub</app>, the procedure is very similar;
 differences are shown in brackets.
           </p>
           </note>
     <steps>
         <item>
           <p>
           Restart your computer, and hold down <key>Shift</key> during bootup
 to get into the Grub menu (<app>Grub</app>: press <key>Esc</key> repeatedly).
           </p>
           <note style="tip">
           <p>
           If you have a dual-boot machine and you choose at boot time which
 operating system to boot into, the Grub menu should appear without the need to
 hold down <key>Shift</key> (or press <key>Esc</key>).
           </p>
           </note>
           <note>
          <p>If you are unable to get into the Grub boot menu, and therefore
 cannot edit any Linux kernel lines, you can
 <link xref="user-forgottenpassword#live-cd">use a live CD to reset your user
 password</link>.
           </p>
           </note>
          </item>
          <item>
           <p>
           Press <key>e</key> to edit the line that begins with the word 'linux'
 (<app>Grub</app>: the line begins with the word 'kernel').  This line may
 actually be wrapped onto a second line.
           </p>
          </item>
          <item>
           <p>
           Add <cmd>init=/bin/sh</cmd> to the end of the line.
           </p>
          </item>
          <item>
           <p>
           Press <keyseq><key>Ctrl</key><key> x </key></keyseq> to boot.
 (<app>Grub</app>: Press <key>b</key> to boot.)
           </p>
          </item>
          <item>
           <p>
           At the <cmd>#</cmd> symbol, type:
           </p>
           <p>
           <cmd>mount -o remount, rw /</cmd>
           </p>
          </item>
          <item>
           <p>
           At the next <cmd>#</cmd> symbol type:
           </p>
           <p>
           <cmd>passwd <var>username</var></cmd>, where <var>username</var> is
 the username of the account you're changing the password for.
           </p>
           <note>
           <p>
               Some distributions do not have a <cmd>root</cmd> password.  On
 these systems you would always be changing the password of a particular
 username, never root.
           </p>
           </note>
          </item>
          <item>
           <p>
          You will be prompted to enter a new UNIX password, and to confirm the
 new password.
           </p>
          </item>
          <item>
           <p>
           Once the password has been successfully changed:
           </p>
           <p>
           # <cmd>mount -o remount, ro /</cmd>
           </p>
          </item>
          <item>
           <p>
           Then:
           </p>
           <p>
           # <cmd>reboot -f</cmd>
           </p>
          </item>

     </steps>
     <p>
       After you successfully log in, you will not be able to access your keyring
 (since you don't remember the old password).  This means that all your saved
 passwords for wireless networks, jabber accounts, etc. will no longer be
 accessible.  You will need to <link xref="#delete-keyring">delete the old
 keyring</link> and start a new one.
     </p>
  </section>
    <section id="live-cd"><title>Reset password using a Live CD or USB</title>
     <steps>
         <item>
           <p>
           Boot the Live CD or USB.
           </p>
          </item>
          <item>
           <p>
           Mount your drive.
           </p>
          </item>
          <item>
           <p>
           Press <keyseq><key>Alt</key><key>F2</key></keyseq> to get the <gui>Run
           Application</gui> window.
           </p>
          </item>
          <item>
           <p>
           Type <cmd>gksudo nautilus</cmd> to launch the file manager with system-wide privileges.
           </p>
           <note style="tip">
           <!-- Translators: do not translate the word "home". -->
           <p>
             Within the drive you just mounted, you can check that it is the right
             drive by clicking <gui> home </gui> and then your username.
           </p>
           </note>
          </item>
          <item>
           <p>
           Go to the top-level directory of the mounted drive.  Then go into the <gui>etc</gui> directory.
           </p>
           <p>
           Locate the 'shadow' file and make a backup copy:
           </p>
           <steps>

           <item><p>
           Right-click on the shadow file and select <gui>copy</gui>.
           </p></item>
           <item><p>
            Then right-click in the empty space and select <gui>paste</gui>.
           </p></item>

           <item><p>
                      <link xref="files-rename">Rename</link> the backup "shadow.bak".
           </p></item>
           </steps>
          </item>


          <item>
           <p>
           Edit the original "shadow" file with a text editor.
           </p>
          </item>

          <item>
           <p>
           Find your username for which you have forgotten the password.  It
 should look something like this (the characters after the colon will be different):
           </p>
           <p>
           username:$1$2abCd0E or
           </p>
            <p>
           username:$1$2abCd0E:13721a:0:99999:7:::
           </p>
          </item>
          <item>
           <p>
         Delete the characters after the first colon and before the second
 colon. This will remove the password for the account.
           </p>
           <p>
           Save the file, exit out of everything and reboot your computer without
 the live CD or USB.
           </p>
          </item>
          <item>
           <p>
           When you boot back into your installation, click your name in the top bar.
           Open <gui>My Account</gui> and reset your password.
           </p>
          </item>
          <item>
          <p>
            For <gui>Current password</gui> do not enter anything, as your
 current password is blank.  Just click <gui>Authenticate</gui> and enter a new
 password.
          </p>
          </item>

     </steps>
     <p>
       After you successfully log in, you will not be able to access your keyring
 (since you don't remember the old password).  This means that all your saved
 passwords for wireless networks, jabber accounts, etc. will no longer be
 accessible.  You will need to <link xref="#delete-keyring">delete the old
 keyring</link> and start a new one.
     </p>
  </section>


  <section id="delete-keyring">
    <title>Get Rid of the Keyring Manager</title>

    <note style="warning"><p>This will delete all your saved passwords for wireless
    networks, instant messaging accounts, etc. Only do this if you can't remember
    the password you used for your keyring.</p></note>

  <steps>
   <item><p>
    Go to your Home folder by typing 'home' in the <gui>Activities</gui> overview.
   </p></item>
   <item><p>
    Press <keyseq><key>Ctrl</key><key>h</key></keyseq> (or click
 <guiseq><gui>View</gui><gui>Show Hidden Files</gui></guiseq>.)
   </p></item>
   <item><p>
    Double click on the folder .gnome2
   </p></item>
   <item><p>
   Double click on the folder called keyrings.
   </p></item>
   <item><p>
   Delete any files you find in the keyrings folder.
   </p></item>
   <item><p>
   Restart the computer.
   </p></item>
 </steps>
<p>
 After you restart and log in you will be asked to enter your wireless networks
 password.
</p>
  </section>

</page>
