Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Jan 2000 13:49:19 -0500 (EST)
From:      Omachonu Ogali <oogali@intranova.net>
To:        freebsd-newbies@freebsd.org
Subject:   Re: mount /cdrom to be used by users
Message-ID:  <Pine.BSF.4.10.10001301347220.38284-100000@hydrant.intranova.net>
In-Reply-To: <3892521C.DF58D4C6@acuson.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Oops, there was a little syntax error.

Try this one:
/*
 * suCD 0.1
 * --------
 * Allows regular (non-root) users to mount the cdrom
 * - Omachonu Ogali <oogali@tribune.intranova.net>
 */

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>

int main(int argc, char **argv)
{
	printf("suCD 0.1\n");
	printf("oogali@tribune.intranova.net\n\n");

	if (getuid() != 0) {
		if (seteuid(0) != 0) {
			perror("seteuid()");
			return -1;
		}
	}

	if (argc < 2) {
		system("/sbin/mount /cdrom");
	} else {
		if (strcmp(argv[1], "mount") == 0) {
			system("/sbin/mount /cdrom");
		} else if (strcmp(argv[1], "unmount") == 0) {
			system("/sbin/umount /cdrom");
		} else {
			printf("%s [action]\n");
			printf("[action] may be either 'mount' or 'unmount'.\n");
			return -1;
		}
	}

	return 0;
}

Compile: cc -o sucd sucd.c
Install: install -g wheel -m 4755 -o root sucd /usr/local/sbin
Run As:  'sucd mount' to mount /cdrom
         'sucd unmount' to unmount /cdrom

Omachonu Ogali
Intranova Networking Group



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-newbies" in the body of the message




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