Closed acook closed 8 years ago
This is by design — the Trash folder is user-specific and you probably don't want files to end up in root
's Trash folder.
The original user is trivially discovered.
Yep, but knowing who the sudoer is is not the problem — moving the files to that user's trash in a reliable, safe, and consistent manner is. trash
specifically does not perform the operation manually, but instead either uses system APIs to do it or delegates it to Finder via Apple Events — in both cases the user of the process determines which Trash folder is used.
In other words, this could be implemented if trash
performed the operation manually, but delegating it to the system instead is an explicit design decision that I consider very important.
That makes sense. Though it is still possible to execute as another user, I'm not sure what the deal is with trying to trash privileged files being allowed by the API, so I can't provide a workaround.
If I do
sudo trash some_protected_file
I get a GUI auth popup.I'd expected it to not need additional permissions when being involved with sudo.