Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm tring to install PostgreSQL on Mac OS 10.6.4 and I need to authenticate as an administrator. In the command line, I have:

su Admin
Password:
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied

My user is a standard (non-administrator) account, Admin is an administrator account, and the directory I'm working in when I execute 'su' is in my Downloads folder. If I do 'su - Admin' then it works, but then I can't access the necessary files! However, 'su Admin' should work because it leaves the environment unchanged.

How should I do this?

share|improve this question

2 Answers 2

up vote -2 down vote accepted

Enable root. Then:

su root 

                      

share|improve this answer
    
Results in "su: Sorry" –  Justin Mrkva Oct 26 '10 at 2:19
    
@jfm429, You might have to enable root first. I updated my answer with a link for Snow Leopard. What version of OSX are you using? –  Jay Oct 26 '10 at 2:45
1  
I really don't want to have to enable root. This is an entirely different topic, but I need to be able to use PostgreSQL for an application but not force users to jump through hoops to use it. I'm probably going to use SQLite for the local database and then have the option of syncing with PostgreSQL... –  Justin Mrkva Oct 26 '10 at 19:10
    
@jfm429, you could use root to install the DB and set-up permissions properly, then disable root. –  Jay Oct 26 '10 at 22:19
    
That defeats the point; again, this needs to be an end-user-accessible process. So far that's the problem I've seen with PostgreSQL is that it's simply insanely difficult to install. The only installer package requires editing kernel settings, which applications should never need to change. –  Justin Mrkva Oct 27 '10 at 20:05

Does the Admin user have at least read and list (execute) access to your Downloads directory and home directory? Bear in mind that on Mac OS X, administrator accounts are not the root user (which is disabled by default) and thus are constrained by file permissions like other mere mortals.

Administrator accounts are, however, sudoers, which allows them to assume many of the powers of root, but this has to be explicitly requested on a case by case basis - usually with sudo. If your su Admin shell is still running after the error message, try doing sudo ls - it should work as it will be run as if by root. Plain ls won't if Admin doesn't have access to that directory.

The answer is to give Admin access to any directories in your home folder you want it to be able to access. Either do this in the Finder with Get Info, or use chmod.

share|improve this answer
    
I did use 'sudo ls' and it worked. However, I tried performing the installation using 'sudo' before every command and it still failed (couldn't find the current working directory for any of the scripts). I ended up just doing it from the admin account. –  Justin Mrkva Oct 26 '10 at 2:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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