Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Jan 2000 10:03:39 -0500 (EST)
From:      Omachonu Ogali <oogali@intranova.net>
To:        Some Person <ntvsunix@hotmail.com>
Cc:        freebsd-newbies@freebsd.org
Subject:   Re: mount /cdrom to be used by users
Message-ID:  <Pine.BSF.4.10.10001300948180.36640-100000@hydrant.intranova.net>
In-Reply-To: <20000130085624.41576.qmail@hotmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
It's kind of sloppy but I thought why not help some people out until I get
a chance to make some better code.

Ok, for the CD-ROM, here's some code for you guys:

--- start of cdmount.c --
/*
 * 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/mount /cdrom");
		} else {
			printf("%s [action]\n");
			printf("[action] may be either 'mount' or 'unmount'.\n");
			return -1;
		}
	}

	return 0;
}
--- End of sucd.c --

Compile: cc -o sucd sucd.c
Install: install -g wheel -m 4755 -o root sucd /usr/local/bin/
Run: 'sucd mount' or 'sucd unmount'

I hope this helps you guys out. =]

Omachonu Ogali
Intranova Networking Group

On Sun, 30 Jan 2000, Some Person wrote:

> This is a newbies mailing list and I think we should all help each other 
> out, otherwise, what's the point of taking part?
> 
> I'm a newbie myself and don't know that answer to that one yet, but if I 
> did, I would still tell you in this mailing list.
> 
> Being a freebsd-newbies list, no one's expected to know everything and where 
> and where not to ask these questions.
> 
> >
> >oh how cute!!!! tell someone there's a 3rd way with no explanation, then
> >tell them this is the wrong mailing list!!!  there is a mailing list for
> >smart-asses :P
> >
> >
> >>From: naddy@mips.rhein-neckar.de (Christian Weisgerber)
> >>To: freebsd-newbies@freebsd.org
> >>Subject: Re: mount /cdrom to be used by users
> >>Date: 29 Jan 2000 04:20:35 +0100
> >>Received: from [204.216.27.18] by hotmail.com (3.2) with ESMTP id
> >>MHotMailBA5BC6E9006ED82197D4CCD81B125B910; Fri Jan 28 21:34:36 2000
> >>Received: by hub.freebsd.org (Postfix, from userid 538)id 179191587E; Fri,
> >>28 Jan 2000 21:31:28 -0800 (PST)
> >>Received: from localhost (localhost [127.0.0.1])by hub.freebsd.org
> >>(Postfix) with SMTPid 07BA41CD6F6; Fri, 28 Jan 2000 21:31:28 -0800
> >>(PST)(envelope-from owner-freebsd-newbies)
> >>Received: by hub.freebsd.org (bulk_mailer v1.12); Fri, 28 Jan 2000 
> >>21:31:27
> >>-0800
> >>Received: from news-ma.rhein-neckar.de (news-ma.rhein-neckar.de
> >>[193.197.90.3])by hub.freebsd.org (Postfix) with ESMTP id 4AD5614EDAfor
> >><freebsd-newbies@freebsd.org>; Fri, 28 Jan 2000 21:31:25 -0800
> >>(PST)(envelope-from daemon@bigeye.rhein-neckar.de)
> >>Received: from bigeye.rhein-neckar.de (uucp@localhost)by
> >>news-ma.rhein-neckar.de (8.8.8/8.8.8) with bsmtp id GAA15130for
> >>freebsd-newbies@freebsd.org; Sat, 29 Jan 2000 06:31:23 +0100
> >>(CET)(envelope-from daemon@bigeye.rhein-neckar.de)
> >>Received: (from daemon@localhost)by bigeye.rhein-neckar.de (8.9.3/8.9.3) 
> >>id
> >>EAA70330for freebsd-newbies@freebsd.org; Sat, 29 Jan 2000 04:20:35 +0100
> >>(CET)(envelope-from daemon)
> >>From owner-freebsd-newbies@FreeBSD.ORG Fri Jan 28 21:39:23 2000
> >>Delivered-To: freebsd-newbies@freebsd.org
> >>Message-ID: <86tma3$24lf$1@bigeye.rhein-neckar.de>
> >>References: <20000128211146.A28301@p166.nopants.net>
> >>Sender: owner-freebsd-newbies@FreeBSD.ORG
> >>X-Loop: FreeBSD.org
> >>Precedence: bulk
> >>
> >>Charles F. Dillon <cfdillon@bellsouth.net> wrote:
> >>
> >> > Is there a way to execute the "(u)mount /cdrom" as user rather than
> >> > having to su to root?
> >>
> >>Yes.
> >>There's also a third way.
> >>
> >> > Is this device permissions?
> >>
> >>No.
> >>
> >> > I noticed the cdplay program
> >>
> >>Doesn't mount. Different problem.
> >>
> >>There's a mailing list for technical *questions*.
> >>This one ain't it.
> >>
> >>--
> >>Christian "naddy" Weisgerber                  naddy@mips.rhein-neckar.de
> >>
> >>
> >>
> >>To Unsubscribe: send mail to majordomo@FreeBSD.org
> >>with "unsubscribe freebsd-newbies" in the body of the message
> >
> >______________________________________________________
> >Get Your Private, Free Email at http://www.hotmail.com
> >
> >
> >
> >To Unsubscribe: send mail to majordomo@FreeBSD.org
> >with "unsubscribe freebsd-newbies" in the body of the message
> 
> ______________________________________________________
> Get Your Private, Free Email at http://www.hotmail.com
> 
> 
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-newbies" in the body of the message
> 




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.10001300948180.36640-100000>