How to use int mount() and int umount() ???

How to use int mount() and int umount() ???

Post by scott johns » Wed, 08 Mar 1995 12:14:25



I am trying to write a simple suid mount/umount  utility which will allow
me to mount/unmount cdroms/floppies without becoming root.  (I'm the only
one who uses the computer, and I'm not hooked up to a network of any sort,
so security is not a problem.)

Doing a man mount gives the prototypes  They are:
        int  mount(const  char  *specialfile,  const  char * dir ,
        const char * filesystemtype, unsigned long rwflag ,  const
        void * data);

        int umount(const char *specialfile);

The parameters  specialfile, dir, and filesystemtype are quite self-
explainatory, as is the parameter rwflag (I assume 1=rw, 0=ro?).  But the
const void * data parameter, I have no idea what it is used for.  The man
page gives no clue; taking a peek at <sys/mount.h> is no more revealing.

So, I ask you, what is this parameter used for????

Thanks,

/sj/

Scott Johnson --  Graduate Slave, ECE Department, Oregon State University
Check out my new (but unfinished) Web page--http://www.ece.orst.edu/~johnsos
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
I bet the Klan wishes they had thought of PC-bashing decades ago...it
makes blatant racism so acceptable.    
                                                                -Steve Roby

 
 
 

How to use int mount() and int umount() ???

Post by R.D. Auchterloun » Fri, 10 Mar 1995 03:00:31




>>I am trying to write a simple suid mount/umount  utility which will allow
>>me to mount/unmount cdroms/floppies without becoming root.  (I'm the only
>>one who uses the computer, and I'm not hooked up to a network of any sort,
>>so security is not a problem.)
>No need to write a utility for that.
>Put the following in your /etc/fstab:
>/dev/fd0    /flop           msdos   umask=0,quiet,user,noauto       1       1
>                                                      ^^^^
>Then a user can mount it.  Same for cdrom.

Caveat: a user can mount it IF ITS AN MSDOS floppy. And not otherwise.
The above line in /etc/fstab is absolutely no help if the user sticks
in a minix floppy (for example).

There's a long thread in c.o.l.admin on this with many more complete
answers in it.

ray


 
 
 

How to use int mount() and int umount() ???

Post by Scott Howa » Fri, 10 Mar 1995 23:29:09




: >>I am trying to write a simple suid mount/umount  utility which will allow
: >>me to mount/unmount cdroms/floppies without becoming root.  (I'm the only
: >>one who uses the computer, and I'm not hooked up to a network of any sort,
: >>so security is not a problem.)

: >No need to write a utility for that.
: >Put the following in your /etc/fstab:

: >/dev/fd0  /flop           msdos   umask=0,quiet,user,noauto       1       1

: >Then a user can mount it.  Same for cdrom.

: Caveat: a user can mount it IF ITS AN MSDOS floppy. And not otherwise.
: The above line in /etc/fstab is absolutely no help if the user sticks
: in a minix floppy (for example).

Normally this isnt a problem - but if it is you can normally overcome
it by adding a few lines of the form
/dev/fd0     /flop/dos        msdos   umask=0,quiet,user,noauto
/dev/fd0     /flop/minix      minix   umask=0,quiet,user,noauto
(etc)

Sure, it's not perfect, but it works...

  Scott.

 
 
 

1. extern void (*signal(int, void (*)(int)))(int);

Subject says it all.  Can anyone explain this
prototype, piece by piece, to me?

        extern void (*signal(int, void (*)(int)))(int);

I can and do use the signal() function frequently,
but I have no idea why the compiler likes me to cast
pointers to functions as so strangely.  A successful
cal looks like:

        signal(SIGCHLD, (void(*)(int))reaper);

Although it only warns me if I don't cast it,
I'd still like to understand what all that mess
in the prototpe means.

Thanks.

-----------------+----------------------------------------
  John Siracusa  | If you only have a hammer, you tend to

2. Serial #on a R/S6K

3. int connect(int sockfd, struct sockaddr *serv_addr, int addrlen )???

4. 2.2.21-2-secure

5. Is there a function like muldiv(int,int,int)?

6. gnome and RH2.5?

7. Converting from unsigned int to int in C++ / More info

8. Tri-Linux single disk

9. urgent: int (int argc, char argv[]) problem

10. I loose int tell(int fd) C function with new glibc !!!

11. urgent: int (int argc, char argv[]) problem

12. Problem with the "int modify_ldt(int, void *, unsigned long)" function.

13. int fchdir(int fildes); (Solaris 2.6)