[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Most directories locked read-only: how to unlock them?



Almut Behrens wrote:

Copy /etc/fstab to /tmp/fstab and fix your "drfaults" typo in there.

	I copied /etc/fstab to /var/fstab and fixed the typ.

Then patch a temporary copy of /bin/mount and libc.so to use /tmp/fstab
instead of /etc/fstab.  To do so, create this little script, make it
executable, and run it as root:

	Because I used /var instead of /tmp I modified your script as follows:

#!/bin/bash	#You suggested /bin/sh

FSTAB=/var/fstab	# var changed from tmp
LIBC=/lib/libc.so.6

perl -pe "s|/etc/fstab|$FSTAB|g" $LIBC >/var/libc.so.6	# var changed from tmp
perl -pe "s|/etc/fstab|$FSTAB|g" /bin/mount >/var/mount	# ditto
chmod +x /var/mount						# ditto
export LD_PRELOAD=/var/libc.so.6				# ditto
/var/mount -n -o remount,rw /

I saved this script as /var/fixfstab, made it executable and -- as root and in /var -- ran ./fixfstab. The following was returned:

: bad interpreter:  No such file or directory

By running find I discovered that /lib/libc.so.6 is linked to /lib/libc-2.3.2.so.

Then tried to read the variables to be created by the script: $FSTAB and $LIBC. Both returned nul. I next entered the FSTAB variable directly (FSTAB=/var/fstab) and then ran $FSTAB, which returned

-bash: /var/fstab: permission denied.

That message confused me, as I have been working as root all along and both fstab and fixfstab are both root files. Fstab is rw, and fixstab is rwx.

Is this information helpful in figuring why the script does not work? I understand what the script is supposed to do, but I have no knowldege of perl.
	

--
				Ken Heard
				
				



Reply to: