Root password retention


Forum: HD Install
Topic: Root password retention
started by: Josiah

Posted by Josiah on Aug. 04 2006,22:40
I have had to reset the root password everytime I reboot.  Is there a way to keep the root password after reboot?  

I want to be able to reboot the computer remotely through SSH and then login again, but I cannot, because once I enter the reboot command, the password erases and I can no longer SSH into the system.

Posted by mikshaw on Aug. 05 2006,00:12
Passwords are stored in /etc/shadow.  Back up this file and restore it to keep your password.
Posted by Josiah on Aug. 05 2006,01:48
Thanks for the suggestion, but this did not work.  Here is what I did:

I went to Emelfm, and typed in the panel on the left "/etc" and hit enter.  I scrolled through this list until I found a directory called shadow (there were two actually, "shadow" and "shadow-") and then clicked it, and clicked "add2filetool".  Emelfm then prints "end of output."  If i try to type in the directory, emelfm prints "you do not have read access on that directory".

Once I rebooted, my root password was not recognized through SSH.

I did happen to notice that there was an entry in /etc called "passwd".  Could that be what I want to add to filetool.lst?

Posted by mikshaw on Aug. 05 2006,05:30
/etc/shadow is a regular file, not a directory.  User dsl does not have read access to this file, but the backup/restore is done by root so that's not important.
/etc/passwd contains user info such as user id and default shell.

Do you have backup/restore enabled?

Posted by Josiah on Aug. 05 2006,19:13
Yes I do have backup restore enabled.  I have backup restore writing to hda3, which is a type 83 linux ext2 partition.  Other far less important settings (resolution, keyboard style, etc) backup and restore seemlessly.  I am using emelfm as "super user."

Do you have any other thought on what might be causing this?

Posted by mikshaw on Aug. 06 2006,02:26
Not sure.  I say that files in /etc are backed up and restored only because that's what I was told.  Personally i don't use backup/restore because I have a persistent home, and the few additional files I need to back up (including /etc/shadow, which by itself is enough to keep my passwords persistent) are restored through the use of a myDSL extension (essentially the same as a DSL backup, but not dynamic and using a different filename).

I wonder if ssh uses its own password, separate from a typical user password?

Posted by Josiah on Aug. 06 2006,04:26
"persistent home"?  What does that do and how do I set it up?

Edit: Also, I'm sure that ssh does not use a password independent of the root and various user passwords.  I can tell this because if I set the root password to, say, "abcdefg" and then enter "abcdefg" in the ssh dialouge (without rebooting first, of course), it goes right through.  Interesting thought though  :)

Posted by mikshaw on Aug. 06 2006,04:55
Setting up a persistent home will allow you to use a linux-formatted harddrive partition to hold your /home/dsl files.  If specified at boot time (either in the bootloader's configuration in frugal, or at the boot prompt in live CD), the partition will be automatically mounted, and any files in /home/dsl will persist from one session to the next without needing to use a backup. It makes DSL into a sort of hybrid between frugal and a traditional harddrive install. I use this instead of backup because i have no need for the portability of frugal DSL but i like many of its other qualities.

The boot option is dsl home=xxxn... for example "home=hda1".  The same can be done for /opt.

Posted by Josiah on Aug. 06 2006,07:09
That sounds great.  I've been looking for something like that.  The default HD configuration has been so frustrating to me that I've looked into switching to a different distro.

Are there any drawbacks to persistent home?  Does it have any impact on RAM usage?  The whole reason I chose DSL in the first place was the fact that I need[ed] it to run on a system with 96 megs of RAM and a pentium 3.

I have a 19 gig hard drive, so if I have to up 500ish megs of HD for persistent home, that's no problem.

Edit: also, can I just enter that command as root in the A terminal, or to I have to put it in as a cheat code at boot up?  If the later, do I have to enter it at every boot up, or will the computer remember it after the first boot up?

Posted by mikshaw on Aug. 06 2006,14:59
It has an impact on RAM in that it uses less than a normal setup. One thing to note is that /home/dsl will appear to still be in /ramdisk, but that is only a link to /mnt/xxxn/home/dsl (or maybe to /home/dsl...i have never quite figured that out).
You cannot send that boot option after the bootloader has done its work.  However, you can run commands to accomplish the same task (it's just more work for you).  I did this for a little while from /opt/bootlocal.sh before I started using the persistent home boot option. Essentially the procedure is:
Become root.
Create a /home directory on a linux-formatted partition (ext or reiser).
Copy the /ramdisk/home/dsl directory into the new home directory, making sure you keep dsl.staff ownership of these files.
Mount the new home to /home.
Point the /ramdisk/home link to the new home.  I'm not sure right now if this is necessary.  If it's already pointing to /home then you don't have to do this.


Drawbacks....

Persistent home does not work on a currently-mounted volume, such as the partition on which KNOPPIX resides.  If you need to use the same partition you must use the "toram" boot option, but that would be a bad idea for you.

Occasionally a DSL upgrade will make a small change to a config file that ultimately has a larger impact on the way DSL behaves.  If you do not temporarily disable the home boot option when upgrading you may miss one or more of these config changes.

Using incorrect syntax or non-existent location while specifying a "home=" location *may* result in data loss.  I did this twice while experimenting with changing home locations, although those experiments were not typical user behavior and you should not be too concerned.

Posted by roberts on Aug. 06 2006,16:34
I have ...

etc/shadow
etc/shadow-

in my .filetool.lst and root password persists just fine.

Posted by Josiah on Aug. 07 2006,18:54
I cannot get persistent home to work.  I am only given the option to enter boot options when using the liveCD.  How can I create a persistent home without booting from the liveCD?
Posted by mikshaw on Aug. 07 2006,19:00
You need to edit your bootloader's configuration file.  It should be located in the boot directory of the partition on which the KNOPPIX file is installed.  If you use grub it's menu.lst, and if you use lilo it's lilo.cfg (or something like that)
Posted by Josiah on Aug. 07 2006,21:31
Mikshaw, thank you for your help so far, but i think you may be vastly overestimating my abilities.  For all intents and purposes, this is my first time using linux.  A barely knew how to find the LILO configuration file (/etc/lilo.conf, as it happens), let alone how to configure it.  Here's the file that lilo.conf displays:

Quote
# /etc/lilo.conf - See: `lilo(8)' and `lilo.conf(5)',

"! Please edit /etc/lilo.conf before running lilo!"


lba32

boot=/dev/hda



install=/boot/boot-menu.b
backup=/dev/null

map=/boot/map


timeout=100


vga=normal


default=Knoppix

image=/vmlinuz
append="lang=de apm=power-off hda=scsi hdb=scsi hdc=scsi hdd=scsi hde=scsi hdf=scsi hdg=scsi hdh=scsi vga=791 quiet BOOT_IMAGE=knoppix"
root=/dev/hda5
label=Knoppix
read-write


????

I've googled around for instructions on configuring the LILO boot loader, but nothing I've seen seems to address the idea of persistent /home or /opt.  Que? :;):

Edit: If it makes it any easier, I can reinstall with grub.  I don't have any real data on the box yet (and if I did, it would be super backed up), so reinstalling is no biggie.

Posted by mikshaw on Aug. 07 2006,21:36
Persistent home and opt are specific to DSL...they're not likely to be mentioned anywhere but on these forums.

See the "append" line?  add "dsl home=hda1" (or whatever your partition) after "BOOT_IMAGE=knoppix".

Lilo requires that you run the command "lilo" after making config changes, and i'm not sure if you need to add any specific parameters to that command for DSL (I've never used lilo in DSL).

This all needs to be done as root, by the way.

Posted by Josiah on Aug. 07 2006,21:58
This is a weird problem: I have lilo.conf opened in beaver (I am root), and I click in the text, and the file appears to be read only.  I go edit>>toggle readonly mode and beaver reads out:

Quote
Readonly mode cannot be toggled: "lilo.conf" is write protected


What is going on here?

Posted by mikshaw on Aug. 07 2006,22:28
The filesystem on which frugal DSL is installed is read-only, as if it were a cd.  In grub it would be easy enough to get around this by editing its boot parameters at runtime.  I don't believe you can do this with Lilo, though, so you might need to boot a live cd, mount the DSL partition, and edit the file from there.

There's probably a simpler solution, but I'm sorry I don't know what it is.

Posted by Josiah on Aug. 07 2006,22:54
So, I reinstalled with grub.

Now about those boot time run parameters...how does that go?  Could you hum a few bars? ;-)

Posted by mikshaw on Aug. 08 2006,03:43
the menu.lst file should be located at /cdrom/boot/menu.lst (or maybe it's /cdrom/boot/grub/menu.lst?  I'm not sure...i boot DSL from grub installed in another distro). This file is probably read-only by default, being on a read-only file system.  You can mount it read-write in at least two ways....

1) If you're already in DSL, issue the mount command on that partition with the remount rw option:
mount /dev/something -o remount rw
I'm not positive that's the proper syntax...never had much reason to remount partitions myself.

2) If you're booting up DSL, wait until Grub displays options to boot, select the DSL system you want to boot (up/down arrow keys to select), press "e" to edit the DSL entry, select the kernel line, press "e" again to edit that line, add "dsl frugal" to the kernel line, press "Enter", then press "b" to boot with your change. This is a temporary change...it will not be there the next time you boot.

After the system boots up, you will hopefully have a writeable partition.  Go to the menu.lst file, find the kernel line for DSL, and add "dsl home=something" as root (something=hda1 or hdb2 or whatever you have available).  The next time you boot, the partition you specified with "something" should be used as your home.

Note that this will not work if "something" is the same partition as the one containing KNOPPIX unless you also use the "toram" boot option.  I wouldn't recommend it with 96mb of ram.

Posted by Josiah on Aug. 08 2006,20:13
Looks like that procedure succeeded in making menu.lst read/write! Yeah!

There appear to be a lot of "kernel line"s though.  Here's what I'm seeing:


Quote
# This sets the default entry to boot.
# Remember that GRUB counts from 0, so 1 is the second entry.

default 0

# This sets the length of time in seconds that grub will wait for the user to select an OS
# before it boots the default on. I reccommend at least 15 seconds.

timeout 15

# Enter the entry for DSL here. Something like this.

title DSL
kernel /boot/linux24 root=/dev/hda1 quiet vga=normal noacpi noapm nodma noscsi frugal
initrd /boot/minirt24.gz  

title DSL fb800x600
kernel /boot/linux24 root=/dev/hda1 quiet vga=788 noacpi noapm nodma noscsi frugal
initrd /boot/minirt24.gz  

title DSL fb1024x768
kernel /boot/linux24 root=/dev/hda1 quiet vga=791 noacpi noapm nodma noscsi frugal
initrd /boot/minirt24.gz  

title DSL fb1280x1024
kernel /boot/linux24 root=/dev/hda1 quiet vga=794 noacpi noapm nodma noscsi frugal
initrd /boot/minirt24.gz  

#title DSL with toram, mydsl, restore, hostname, and passwords
#kernel /boot/linux24 root=/dev/hda1 quiet vga=normal noacpi noapm noscsi frugal dma toram mydsl=hda5 restore=hda5 host=DSL1 secure
#initrd /boot/minirt24.gz

#title DSL with XFree86
#kernel /boot/linux24 root=/dev/hda1 quiet vga=normal noacpi noapm noscsi frugal dma toram mydsl=hda5/xfree restore=hda6 host=DSL1 secure
#initrd /boot/minirt24.gz

#title DSL with mydsl, restore, persistentancy, hostname, and passwords
#kernel /boot/linux24 root=/dev/hda1 quiet vga=normal noacpi noapm noscsi frugal dma toram mydsl=hda3 restore=hda3 home=hda3 opt=hda3 host=DSL1 secure
#initrd /boot/minirt24.gz

#title DSL Runlevel 2
#kernel /boot/linux24 root=/dev/hda1 quiet vga=normal noacpi noapm noscsi nodma frugal 2 base norestore
#initrd /boot/minirt24.gz

#title Windows
#root (hd0,0)
#chainloader +1
#makeactive
#boot


At this point though, I have to wonder, would all the stuff I'm trying to do be accomplished if I simply did a debian type install with DSL or with real-life KNOPPIX?  This seems like a lot of work to turn off the delete everything at reboot feature.

Posted by mikshaw on Aug. 08 2006,23:42
I can't say what would be best for you.  Personally I think frugal with persistent home is nice for DSL, but i also have other distros in which i don't think i'd like this setup.

The several kernel lines above are each used in only one DSL configuration.  It looks like you have 4 choices when you boot (5 are commented out, including windows), and when you make a choice only one kernel line is used.  This can be very useful for booting DSL in various configurations, all using the same DSL installation.

The default is listed as entry 0, which is the first entry. You could either modify that first entry (title DSL) or make a copy of it and edit the copy.  For example, if you copy this:
Code Sample
title DSL
kernel /boot/linux24 root=/dev/hda1 quiet vga=normal noacpi noapm nodma noscsi frugal
initrd /boot/minirt24.gz

and then paste it and edit the copy as this:
Code Sample
title DSL test
kernel /boot/linux24 root=/dev/hda1 quiet vga=normal noacpi noapm nodma noscsi frugal dsl home=hda1
initrd /boot/minirt24.gz

Then it should provide you with a persistent home in /mnt/hda1/home when you select "DSL test" from the grub menu.

Posted by Josiah on Aug. 09 2006,02:09
mikshaw it worked!  Home and the root password persist just fine now!  Thank you!

A new question though:

When I changed from LILO to grub, it threw out the LILO option to have the ssh server start at boot.  How do I set ssh to start at boot up?

Since I will be running DSL as a server without any mouse, keyboard, or monitor, it is essential that I have ssh start with the system.

Posted by mikshaw on Aug. 09 2006,03:01
put "ssh" on that same line.  I'm not sure, but it might need to go after "dsl".

If that doesn't work, it could be that sshd is being started before the password is restored, but i'm not sure about that either.

Posted by Del on Aug. 10 2006,01:02
Indeed, the 'ssh' boot param fires off sshd before /etc/passwd is restored. On my other machine (running DSL-N, but still similar) I have /etc/passwd, /etc/shadow and /etc/ssh (I think it's called that, the sshd config dir) in .filetool.lst. The last one is so the ID key thing is saved between boots and not regenerated every time. Then in bootlocal.sh I have sshd starting, that way it fires up after /etc/* is restored.
Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.