Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Create a 'one-time-use' root-enabled GUI Finder Desktop
As an alternative to the much older hint Create a GUI Finder with root access, I found an easier way to do this. Open a new Terminal window and type:
sudo /System/Library/CoreServices/Finder.app/Contents/MacOS/Finder
After giving your root password, a Finder window with root privileges pops up behind your Terminal. Do the dangerous stuff you want to do but weren't able to do with "normal" privileges (eg copying Fink's entire /sw folder). When you're done being dangerous, close your root Finder window by pressing Control-C in the Terminal (thus exiting the sudo command). The root Finder window will vanish.

Note that other Finder windows you had open when creating the root window will retain their original file privileges and will not become root.

[robg adds: As with anything running as root, be very careful with this one. You can do some Really Bad Things. This hint is to be used at your risk ... have you backed up lately? :) ]
    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[8,406 views]  

Create a 'one-time-use' root-enabled GUI Finder | 15 comments | Create New Account
Click here to return to the 'Create a 'one-time-use' root-enabled GUI Finder' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Create a 'one-time-use' root-enabled GUI Finder
Authored by: laurence.wilks on Nov 02, '04 10:31:39AM

Note that if you close the terminal window without issuing a Control-C first the Finder windows stays open with root privileges!



[ Reply to This | # ]
Create a 'one-time-use' root-enabled GUI Finder
Authored by: hypert on Nov 02, '04 12:31:13PM
I'm not in front of my Mac to test this, but you should be able to leave the root-Finder open indefinitely by just backgrounding the command:

sudo /System/Library/CoreServices/Finder.app/Contents/MacOS/Finder &


[ Reply to This | # ]
Create a 'one-time-use' root-enabled GUI Finder
Authored by: Auricchio on Nov 02, '04 11:38:14AM
It's quite dangerous to be running two copies of the Finder (or any program) simultaneously.

Both copies could modify Preferences or other files, resulting in corruption of those files.

Newly created files could have the wrong owner (in this case root), which would cause other complications. Suppose, for example, the Finder were to delete and re-create its plist file in normal operation. You could end up with the plist owned by root. (This probably isn't the way a program would update a file, but it is possible.)

Be extremely careful with duplicate copies of programs running simultaneously!

---
EMOJO: mojo no longer workin'

[ Reply to This | # ]

Create a 'one-time-use' root-enabled GUI Finder
Authored by: rspeed on Nov 02, '04 11:49:24AM

Though I agree it is a bad idea, in this case that would not be true. The Finder running as root would use /var/root/ as it's home folder and therefore would not interfere.



[ Reply to This | # ]
The real deal on sudo and preferences
Authored by: ahruman on Nov 03, '04 10:48:25AM

As it happens, you're both wrong. Sudo passes all environment variables, including $HOME, to the process it launches. This means that the new Finder process will use the home folder of the user who typed the sudo command. However, the preferences file is accessed through a system library (using NSUserDefaults or CFPreferences), which ensures preferences file is not corrupted (it will contain the preferences as understood to the last application that wrote to it) and that its owner is not changed.

A couple of other notes: if you leave the sudoed Finder running, you can kill it as follows:
% sudo ps -x
(Find the pid of the Finder in the list, e.g. 642)
% sudo kill 642

Also, the password you give to sudo is not "your root password", as the article says, but your normal password. This only works if your account has sudo privileges, which usually means an administrator account.

Incidentally, if you're not logged in with admin priviledges, you can:
% login youradminaccount
password: [your admin password]
% sudo whatever
Password: [your admin password, again]

In this case, if "whatever" is the finder, it will run with youradminaccount's preferences.



[ Reply to This | # ]
Create a 'one-time-use' root-enabled GUI Finder
Authored by: hypert on Nov 02, '04 12:34:47PM
Along similar lines, I have an alias called "root" in my environment that simply runs
sudo tcsh
Then, I'm effectively root for the time being, even though the root account is "disabled".

[ Reply to This | # ]
Create a 'one-time-use' root-enabled GUI Finder
Authored by: fracai on Nov 02, '04 01:17:00PM
an alternative would be
sudo su
I'm not sure if either of these is more proper or beneficial

---
i am jack's amusing sig file

[ Reply to This | # ]

Or ...
Authored by: googoo on Nov 03, '04 10:00:14AM
Or you could just use

sudo -s

This runs the default shell as root. (The default shell is bash under 10.3 and tcsh under earlier versions unless you have changed it.)

-Mark

[ Reply to This | # ]

Create a 'one-time-use' root-enabled GUI Finder
Authored by: gshenaut on Nov 02, '04 01:46:03PM

Since this hint involves using a shell command (in a very unsafe way, it seems to me), why not just do whatever you want to do via a shell command? For example, "sudo cp -Rp /sw /what/ever". It's faster, easier, and safer.

Greg Shenaut



[ Reply to This | # ]
Create a 'one-time-use' root-enabled GUI Finder
Authored by: jiclark on Nov 02, '04 02:49:49PM

See, that's what's so amazing about you Unix gurus... You can't imagine (or remember) what it's like to not be able to do things from the CL without even thinking about it! ;-}

"...faster, easier and safer"

For you maybe! To those of us for whom shell commands don't just flow out of our fingertips, it may be safer, but as for faster and easier... I'm afraid not!

I only wish it were so...



[ Reply to This | # ]
Create a 'one-time-use' root-enabled GUI Finder
Authored by: gmachen on Nov 02, '04 04:33:03PM

Easier yet: use Pseudo (uncrippled shareware) ...

<http://personalpages.tds.net/~brian_hill/pseudo.html>

... to make a Pseudo "Launch Document" pointing to the Finder ...

/System/Library/CoreServices/Finder.app

... and thereafter all one needs do is double-click it to launch a second Finder as root.



[ Reply to This | # ]
Create a 'one-time-use' root-enabled GUI Finder
Authored by: gshenaut on Nov 03, '04 03:27:56PM

Well, obviously for many it is easier to drag a directory than it is to issue a shell command. But that isn't the comparison I was making. The original hint involved a much more complicated and subtle use of the shell to start up the finder.

But it is true that facility with the shell is a useful skill.

Greg Shenaut



[ Reply to This | # ]
Tell apart the root finder from the normal finder
Authored by: thelamecamel on Nov 03, '04 08:22:37PM
If you're going to do this, I recommend having a different appearance for the root finder windows, i.e. having graphite close buttons and sliders rather than the red, amber, green aqua ones (or vice versa). Then you'll know at a glance which windows belong to root, and which belong to you. The simplest way, as shown in the comments to this hint is to enter in a Terminal window
 sudo /Applications/System\ Preferences.app/Contents/MacOS/System\ Preferences 
which will open System Preferences as root, then click the General button and change the "Appearance" option to whatever you don't use. (while you're in there you could also change default keyboard layouts, etc if that's your kind of thing)

Then any window which can do the bad stuff will appear in the graphite scheme, not the aqua scheme (or vice versa)

[ Reply to This | # ]

What's wrong with FUS?
Authored by: jporten on Nov 08, '04 07:44:26PM

Have Pseudo. Tried Darwin tricks. Made it too easy to be stupid. So now I use Fast User Switching to fire up a root GUI, do what I need to, and log out. Leaves no question as to "who" is doing what.



[ Reply to This | # ]
What's wrong with FUS?
Authored by: rmiller021 on Nov 15, '04 03:36:40PM
Interesting has anyone tried this using ichat twice, even if you use
 su <second user> path to ichat 
it still shows your current buddy list with some strange side effects, so the question is, does anyone know a way to make the second ichat load the other users buddy list?

[ Reply to This | # ]