From: Bryan Dunn <bdunn@sels.rsc.raytheon.com>
Subject: running a script with sudo
Date: Tue, 28 Aug 2001 13:12:24 -0400 [thread overview]
Message-ID: <3B8BD0F8.187AC11D@sels.rsc.raytheon.com> (raw)
Hi all,
I am having trouble running a script with sudo permissions. I put a
line in the sudoers file which looks like this:
Cmnd_alias MOUNTCD = /usr/mount_dec_cd.pl
then later on:
username machine = MOUNTCD
The script runs fine as root, but it will not work as the user. First,
it can't use the command scu sho edt, and then produces other errors.
What am I doing wrong?
Here is the script itself:
chomp ($Choice);
if (($Choice ne "n")||($Choice ne "N")) {
system "mkdir $Target";
}
}
$Output = readpipe ("scu sho edt|grep -e CD-ROM -e Read-Only");
system "echo $Output";
my @Scsiid;
my $index=2;
while($Output =~ /(\s\d)/g) {
$Scsiid[$index] = $1;
$index--;
}
print "The Scsi ID is {$Scsiid[2] $Scsiid[1]}\n";
my $rznum = 0;
$rznum += $Scsiid[2] * 8;
$rznum += $Scsiid[1] * 1;
my $RawName = "rz${rznum}c";
print "The raw device name is $RawName\n";
system "mount -t cdfs -o ro /dev/$RawName $Target";
--
________________________________
|Bryan Dunn |
|Systems Administrator |
|Raytheon Corporation |
|E-Mail: bdunn@marmail.ed.ray.com|
|Phone: 508-490-2948 |
|Pager: 508-727-1054 |
|________________________________|
next reply other threads:[~2001-08-28 17:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-08-28 17:12 Bryan Dunn [this message]
2001-08-29 19:16 ` running a script with sudo Michael Heiming
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox