Tweaking the applescript code should be harmless but you should know how to adjust the chmod command to make your app directly runnable again. I don't recommended tweaking the ruby script unless you really know what you're doing because it's doing certain things as root (the privileged user). The ruby script is meant to work for most OS X application bundles.via USB drive) they can still get access to your mail. If someone is able to copy the Mail app to your computer (e.g.That's left as an exercise for the reader. You can tighten up security by changing the owner of the MacOS/Mail file to root. If you didn't need the "sudo" command above to do the chmod, that means a savvy user might be able to figure out how to enable the Mail app again.Note that sudo will ask you for your password to allow privileged operation. Use sudo if you get "Operation not permitted". If you ever want to allow Mail to run normally again, run this command at the Terminal: sudo chmod +x /Applications/Mail.app/Contents/MacOS/Mail Note that it means ALL users on your machine will be prevented from running Mail directly, not just your user. So run the script once, then try running the Mail app. After it's done running, it will disable access to the regular Mail application. Every time you run it, it will ask you for your password (just like some installers do). Now "mail_with_password" will appear in your script menu. Save the file into Library/Scripts as "mail_with_password", making sure the File Format is "Script". Next, start Script Editor and paste in this code (again changing johndoe to your username): do shell script "ruby /Users/johndoe/Library/Scripts/run_with_password.rb /Applications/Mail.app" with administrator privileges $stderr.puts "setting effective to #" if $DEBUG # run 'id' at the terminal to find out what your username is. # Note: anyone with sudo access will be able to run as this user. Now open your Library/Scripts folder and create a file called "run_with_password.rb" with these contents (change "johndoe" to your username): #!/usr/bin/env ruby Read the "Script Menu" section here: Enable the Script Menu First, you should enable the script menu in the OS X menu bar.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |