Non-Admin Users and Disk Utility
Is there a way to bypass the admin account/password entry when using Disk Utility to erase CDRW or zip drives?
I see the precaution in not letting nonadmin users nuke a system, however some people come in thinking mmm,..CD-RWs! and it begins to be a pain having to login for them...
any ideas?
I see the precaution in not letting nonadmin users nuke a system, however some people come in thinking mmm,..CD-RWs! and it begins to be a pain having to login for them...
any ideas?
Comments
Originally posted by Dark Seraph
Is there a way to bypass the admin account/password entry when using Disk Utility to erase CDRW or zip drives?
I see the precaution in not letting nonadmin users nuke a system, however some people come in thinking mmm,..CD-RWs! and it begins to be a pain having to login for them...
any ideas?
Hi,
I've written a little AppleScript to do that. First, a little...
...WARNING: This script hasn't been fully tested
yet - if you deceide to test it, this is done at your own risk
Open a new file in the script editor, paste the script code, insert your
admin password at the "thePasswd" line and save it as an application
(w/o startup screen and as a run-only app).
Another warning: Saving the script as a run-only
protects it from being opened in the script editor. But anyone with some
computer knowledge will be able to read the admin password from the
script file by opening it in some editor such as BBEdit, for example.
Okay, and now that we're through with that - here's the script.
Greetings!
durandal
P.S.: If there are any errors/problems/questions, post'em here or mail me (or both, whatever
global diskName
global theFormat
property thePasswd : "yourpassword" -- insert your admin passwd here
on run
getDiskNameAndData()
eraseDisk()
end run
on getDiskNameAndData()
tell application "Finder"
set VolumeList to name of (every disk whose ejectable = true)
set diskName to item 1 of (choose from list VolumeList with prompt "Choose a disk to erase..." without empty selection allowed and multiple selections allowed)
if (format of disk diskName) is in {Mac OS format, Mac OS Extended format, UFS format} then
if (format of disk diskName) as text = "Mac OS format" then set theFormat to "HFS"
if (format of disk diskName) as text = "Mac OS Extended format" then set theFormat to "HFS+"
if (format of disk diskName) as text = "UFS format" then set theFormat to "UFS"
else
display dialog "Sorry, but the selected disk isn't formatted with a supported file system (supported systems are Mac OS, Mac OS Extended and UFS)" buttons "OK" default button 1
return false
end if
end tell
end getDiskNameAndData
on eraseDisk()
activate me
display dialog "Do you really want to ERASE the Volume \\"" & diskName & "\\"? This cannot be reverted!" with icon caution
display dialog "Please stand by while the Volume is erased - a dialog will appear as soon as process is completed..." buttons {"Go"} default button 1
try
do shell script "diskutil eraseVolume " & theFormat & " " & diskName & " /Volumes/" & diskName password thePasswd with administrator privileges
on error errmsg number errnum
display dialog "An error occured while trying to erase the volume!
Error Text: " & errmsg & "
Error Number: " & errnum buttons "Sh**!" default button 1 with icon stop
return false
end try
display dialog "The disk has been successfully erased!" buttons "OK" default button 1
end eraseDisk
(not fully test on pather they say)
http://www.macosxlabs.org/tools_and_...s_archive.html
let me know if it works if anyone beats me to it...
(not fully test on pather they say)
http://www.macosxlabs.org/tools_and_...s_archive.html
let me know if it works if anyone beats me to it...