[Ilugc] One Day One Command

Raja Subramanian rsubr at pcomm.hfi.unimelb.edu.au
Tue Feb 15 20:27:59 IST 2005


Hi,

Bharathi Subramanian wrote:
> One Day One Command :-
> ====================
...

> mount  -- Mount/Attach a File System to a File Tree.
> # mount -t tmpfs none /mnt/test1 -o rw,size=1m -- Mount a tmpFS
> # mount -t tmpfs none /mnt/test1 -o remount,ro,size=1m -- Remount the
> same partition with different permission.

I find the last one most useful during rescue operations in single user mode.

Here is how a typical root password recovery would go -

In lilo/grub pass the "init=/bin/sh" option to the kernel and you will
be dropped into a root shell with only / mounted.  The kernel usually mounts
/ as read-only so that fsck can be run.  And here is the rest -

    # mount -o remount,rw /
    # mount /proc       # you may need this
    # passwd root
        ...
    # umount /proc
    # mount -o remount,ro /
    # exec /sbin/init

- Raja



More information about the ilugc mailing list