Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Jul 1997 20:19:25 -0400
From:      Randall Hopper <rhh@ct.picker.com>
To:        hackers@freebsd.org
Subject:   suid "mountzip" -- UFS works but MSDOS doesn't (?)
Message-ID:  <19970702201925.23792@ct.picker.com>

next in thread | raw e-mail | index | archive | help
     I have a suid perl script that I use to mount file systems on my ZIP
drive (attached).  It works fine for for UFS, but the MSDOS mount denies
permission.

     Any ideas why?


> mountzip
/dev/sd0s1 on /zip: Incorrect super block.
msdos: /dev/sd0s4: Permission denied
Mount failed
__________________________________________________________________________

> cat /opt/bin/mountzip

# cat /opt/bin/mountzip
#!/usr/bin/suidperl -w

$ENV{'PATH'}  = '/bin:/usr/bin:/usr/sbin:/sbin';
$ENV{'SHELL'} = '/bin/sh' if defined $ENV{'SHELL'};
$ENV{'IFS'}   = ''        if defined $ENV{'IFS'};

( !system( "mount /zip"    ) && print "/zip mounted\n"    ) || 
( !system( "mount /doszip" ) && print "/doszip mounted\n" ) || 
die "Mount failed\n";

__________________________________________________________________________

> ls -l /opt/bin/mountzip
-rws--x---  1 root  wheel  326 May  4 09:34 /opt/bin/mountzip*

> ls -l /sbin/mount /sbin/mount_msdos
-r-xr-xr-x  1 bin  bin   69632 Mar 25 14:42 /sbin/mount*
-r-xr-xr-x  1 bin  bin  139264 Mar 25 14:43 /sbin/mount_msdos*

> grep zip  /etc/fstab
/dev/sd0s1              /zip            ufs     rw,noauto       0       0
/dev/sd0s4              /doszip         msdos   ro,noauto       0       0

> ls -l /dev/sd0s[14]
brw-r-----  1 root  operator    4, 0x00020002 May  5 19:36 /dev/sd0s1
brw-r-----  1 root  operator    4, 0x00050002 May  5 19:36 /dev/sd0s4

> ls -ld /zip /doszip
drwxr-xr-x  2 root  wheel  512 May  5 19:44 /doszip/
drwxr-xr-x  2 root  wheel  512 May  5 19:44 /zip/



BTW, this is on 2.2.1.

Randall Hopper



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19970702201925.23792>