0

how do I access the root directory in osx 10.9.5 (Mavricks). I get the red no access logo and Permission denied under terminal despite enabling root user and being in an administrator account. Tried Sudo ls var/root but it just asks for the password and does nothing.

mgp:var mgp$ ls
agentx          folders         netboot         spool           tmptmpdbUuZwC       tmptmpdbmW0Yg
at          jabberd         networkd        tmp         tmptmpdbUuZwC-journal   tmptmpdbmW0Yg-journal
audit           lib         root            tmptmpdb5e8iN       tmptmpdbdMcpS       vm
backups         log         rpc         tmptmpdb5e8iN-journal   tmptmpdbdMcpS-journal   webmin
db          mail            run         tmptmpdbOG3yt       tmptmpdbfseF0       yp
empty           msgs            rwho            tmptmpdbOG3yt-journal   tmptmpdbfseF0-journal
mgp:var mgp$ cd root
-bash: cd: root: Permission denied
mgp:var mgp$ 

I understand that SIP was implemented in El Capitain so what is preventing me on my older version?

Any ideas?

  • What do you hope to find in there? You can see inside the root folder even with SIP enabled... you can even just add ACLs using the GUI if you need to dig deeper... but there's not much to see. Root really doesn't do much at all on OS X. – Tetsujin Aug 11 '17 at 11:41
0

I think you're confusing being an admin vs being root. Running as an admin, there are a few things you can do that a standard user can't, but you do not have root rights. You can use sudo to run commands as root, but you aren't root yourself and are still subject to normal file permissions (including not being able to read /var/root).

"Enabling" root does not change this at all. What it does is allow you to log directly in as root. At the login screen, you'll see an "Other" icon; if you select that and then enter the name "root" and the password you assigned the root account, you'll then actually be logged in as root. Don't do this. When you log in as root, everything you do is done with most of the regular protections bypassed, so it's easy to mess things up thoroughly. It's much safer to run as an admin, and use things like sudo to run just specific operations as root.

About using sudo: you need to be an admin to use it, and it'll ask for your password (for the admin account, not the root account) unless you've used it recently (this is to make sure it's really you). sudo ls /var/root should work, although the root home directory may be mostly empty. sudo cd /var/root will not work, because cd runs as a subprocess and doesn't affect your shell.

One thing you can do to sort-of become root is to use sudo -s to open a new shell as root. After you do that, you can run a series of commands as root (including cding to /var/root, etc). This is kind of dangerous, but not as bad as actually logging in as root.

  • Oh, thanks Gordon, I thought that enabling the root user increased the permissions level for the same admin account but I see now it just allows you to login at boot up as a root user.... I didn't want to alter anything, just be able to look. – Maurice Dec 14 '17 at 19:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.