Launch as Root and file saving

34 views
Skip to first unread message

1.61803

unread,
Jan 28, 2013, 10:10:31 AM1/28/13
to blacktree-...@googlegroups.com
If I select /Applications/ACP/PlistEdit.app and run it with Launch as Root I cannot save files due to permissions and get the message

You don't have permission to save the file “Test.plist”.
To view or change permissions, select the item in the Finder and choose File > Get Info.

If I run in Terminal sudo -b /Applications/ACP/PlistEdit.app/Contents/MacOS/PlistEdit I can save the same file (root:wheel 644).

Tested with TextEdit, same outcome.

How does the action actually work?

Why is it not available for binaries?

Patrick Robertson

unread,
Jan 28, 2013, 10:22:48 AM1/28/13
to blacktree-...@googlegroups.com
The action code is here

Perhaps the execute line just needs the -b flag adding to it.
Feel free to take a look at the plugin and if you manage to fix it either let us know or open a pull request :)

The action's available for the types as listed here
Types can now (as of ß71) be UTIs so it may be possible to expand the list to include binaries, but it appears that binaries don't actually have a UTI

(try "$ mdls binary " in Terminal)

--
You received this message because you are subscribed to the Google Groups "Quicksilver" group.
To post to this group, send email to blacktree-...@googlegroups.com.
To unsubscribe from this group, send email to blacktree-quicks...@googlegroups.com.
Visit this group at http://groups.google.com/group/blacktree-quicksilver?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

1.61803

unread,
Jan 28, 2013, 11:31:05 AM1/28/13
to blacktree-...@googlegroups.com
On Monday, January 28, 2013 4:22:48 PM UTC+1, Patrick wrote:
Perhaps the execute line just needs the -b flag adding to it.

I doubt the sole background option will solve the permissions problem.
 
Feel free to take a look at the plugin and if you manage to fix it either let us know or open a pull request :)

I'd love to if I could just decipher Objective-C. For now, it's a past year resolution :)


By testing other actions I found that if I run sudo -b /Applications/ACP/PlistEdit.app/Contents/MacOS/PlistEdit with Run Command in Shell, authenticate, quit the app, wait 5' and run it again, QS still keeps the password stored as it appears already typed in the authentication field, see attachment.


1.61803

unread,
Feb 1, 2013, 9:39:13 AM2/1/13
to blacktree-...@googlegroups.com, robertso...@gmail.com
On Monday, January 28, 2013 5:31:05 PM UTC+1, 1.61803 wrote:
By testing other actions I found that if I run sudo -b /Applications/ACP/PlistEdit.app/Contents/MacOS/PlistEdit with Run Command in Shell, authenticate, quit the app, wait 5' and run it again, QS still keeps the password stored as it appears already typed in the authentication field, see attachment.

Is this normal behaviour?

1.61803

unread,
Jun 16, 2015, 12:38:59 PM6/16/15
to blacktree-...@googlegroups.com, robertso...@gmail.com
If Merlin won't go to the mountain…

Since the Launch as Root plugin action doesn't work as expected, I came up with this applescript action to open an application's binary and a some file as root.

If anyone knows how to make the 3rd pane optional, please let me know.

using terms from application "Quıcĸsıɩⅴεʀ"

on open files direct_objects with indirect_objects

set theAppPath to (POSIX path of direct_objects)

set theFilePath to (POSIX path of indirect_objects)

set theCFBundleExec to (do shell script "defaults read '" & theAppPath & "Contents/Info.plist' CFBundleExecutable")

set theCommand to ("sudo -b " & theAppPath & "Contents/MacOS/" & theCFBundleExec & " && sleep .5 && open -a " & theAppPath & space & theFilePath)

display dialog "Please verify that the following command is correct." default answer theCommand buttons {"Cancel", "Run"} cancel button "Cancel" default button "Run"

do shell script theCommand with administrator privileges

end open files

on get argument count

return 2

end get argument count

on get direct types

return {"NSFilenamesPboardType", "NSStringPboardType"}

--return {"com.apple.application-bundle"} -- UTI doesn't work, see tracker

end get direct types

on get indirect types

return {"NSFilenamesPboardType", "NSStringPboardType"}

end get indirect types

end using terms from

1.61803

unread,
Jul 4, 2015, 9:04:20 PM7/4/15
to blacktree-...@googlegroups.com, robertso...@gmail.com
I emended the action to correctly run the command if edited.

using terms from application "Quıcĸsıɩⅴεʀ"

on open files direct_objects with indirect_objects

set theAppPath to (POSIX path of direct_objects)

set theFilePath to (POSIX path of indirect_objects)

set theCFBundleExec to (do shell script "defaults read '" & theAppPath & "Contents/Info.plist' CFBundleExecutable")

set runBinaryOnly to ("sudo -b " & theAppPath & "Contents/MacOS/" & theCFBundleExec)

set openFile to (runBinaryOnly & " && sleep .5 && open -a " & theAppPath & space & theFilePath)

display dialog "Please verify that the following command is correct." default answer openFile buttons {"Cancel", "Run Binary Only", "Open File"} default button "Run Binary Only" cancel button "Cancel" with title "Launch As Root…" with icon stop giving up after 30 -- allows editing and then running openFile

if button returned of result is "Run Binary Only" then

do shell script "logger -t 'AS DEBUG' " & (quoted form of runBinaryOnly)

do shell script runBinaryOnly with administrator privileges

else if button returned of result is "Open File" then

set openFile to text returned of result

do shell script "logger -t 'AS DEBUG' " & (quoted form of openFile)

do shell script openFile with administrator privileges

end if

end open files

on get argument count

return 2

end get argument count

on get direct types

return {"NSFilenamesPboardType", "NSStringPboardType"}

--return {"com.apple.application-bundle"}

end get direct types

Reply all
Reply to author
Forward
0 new messages