From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <96078701111381.tru64-unix-managers.marc@archive.invalid> From: lombardi emanuele Date: Wed, 11 Mar 1998 14:50:18 +0000 To: tru64-unix-managers Subject: SUMMARY: not-ROOT CDROM mounting X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=96078701111381 Dear Gurus, Here the SUMMARY of my last question concerning the way to allow normal users to mount their own CD without any root privilege. Many people suggested to install sudo which allows authorized users to have root privileges. The second suggested way is to make a small program running setuid to execute the mount command. I prefer the 2nd way so that I can restrict the freedom of my users to the minimum (you never know what they can do ...). So here the C code I wrote. It is named monta which is italian for mount. It allows both mount and umount of cdrom Its sintax is as follows: to mount: monta [-d dev] [-o opts] ... [-o opts] dir to umount: monta [-d dev] -u defaults: dev=/dev/rz4c opts=NONE But, of course, you can easily change the default device setting it as the first element of devs that is devs[0] I hope this code helps people, In any case, please, send me bugs and info and comments... Thanks to all of you who answered my original question, Greetings from Italy, Emanuele Emanuele Lombardi mail: AMB-GEM-CLIM ENEA Casaccia I-00060 S.M. di Galeria (RM) ITALY mailto:lele@mantegna.casaccia.enea.it tel +39 6 30483366 fax +39 6 30483591 /* monta.c Program to allow users to mount CDROM without the need to be root. Users can choose among a list of availabel devices (devs) the first of which is the default one See the section code referring the -h switch for the usage of monta. don't forget to chmod 4555 the executeble! by EMANUELE LOMBARDI lele@mantegna.casaccia.enea.it */ #include main(argc,argv,en) int argc; char *argv[]; char *en[]; { #define ARGS "o:ud:h" #define NDEVS 2 #define MAXNS 20 char *al[MAXNS] = NULL; char *devs[NDEVS],*dev; int umount,ns,i,c,okdev; extern int errno; setruid(0); devs[0]="/dev/rz4c"; /* default device*/ devs[1]="/dev/gd0c"; dev=devs[0]; al[0] = "/usr/sbin/mount"; al[1] = "-t"; al[2] = "cdfs"; al[3] = "-r" ; ns=4; umount=0; while (((c = getopt(argc, argv, ARGS)) != -1)) switch (c) { case 'd': okdev=0; for (i=0;i