Web Hosting Talk







View Full Version : Secure tmp


dlc2000
06-20-2004, 07:01 PM
Hi

what setting do u add in /etc/fstab?

i use

/dev/md3 /tmp ext3 rw,noexec,nosuid 1 2

but i see that someone like to use

/dev/tmpMnt /tmp ext2 loop,noexec,nosuid,rw 0

but i dunno the difference

thx

Steven
06-20-2004, 07:21 PM
Theres different purposes, the first one is for a real partition, the second one is for a created partition such as


cd /usr
dd if=/dev/zero of=tmpMnt bs=1024 count=256000
mkfs -t ext3 /usr/tmpMnt


then u could mount it like

mount -o loop,noexec,nosuid,rw /usr/tmpMnt /var/tmp


or with

/dev/tmpMnt /tmp ext3 loop,noexec,nosuid,rw 0 0

in fstab and rebooting or doing


mount -a

dlc2000
06-20-2004, 07:29 PM
ok but is better to use:

rw,noexec,nosuid 1 2

or

loop,noexec,nosuid,rw 0 0

Thx

Steven
06-20-2004, 07:47 PM
Depends on the application. Is your /tmp a real partition on the drive or one you created?

dlc2000
06-20-2004, 07:48 PM
it is a real partition

thx

linux-tech
06-20-2004, 08:07 PM
rw is the one you want then.

any real partition will show up as
/dev/hd*
/dev/sd*
/dev/md*
/dev/cd*
and I'm sure I forgot some

from the man page on mount:

THE LOOP DEVICE
One further possible type is a mount via the loop device. For example,
the command

mount /tmp/fdimage /mnt -t msdos -o loop=/dev/loop3,blocksize=1024

will set up the loop device /dev/loop3 to correspond to the file
/tmp/fdimage, and then mount this device on /mnt. This type of mount
knows about three options, namely loop, offset and encryption, that are
really options to losetup(8). If no explicit loop device is mentioned
(but just an option ‘-o loop’ is given), then mount will try to find
some unused loop device and use that. If you are not so unwise as to
make /etc/mtab a symbolic link to /proc/mounts then any loop device
allocated by mount will be freed by umount. You can also free a loop
device by hand, using ‘losetup -d’, see losetup(8).