hi there,
>> % /usr/local/pgsql/bin/initdb --pgdata=/var/data/pgsql --username=testuser
>> could not identify current directory: Permission denied
>
> What directory are you in when you give this command? (AFAIR su doesn't
> change directory ... you might be better off with su - testuser ...)
hmmmm, that's an interesting question.
per your suggestion i tried "su - testuser", then various combos of su, su -,
sudo, etc, etc. -- all to no avail.
then, i stumbled across the following behavior.:
(1)
% rm -rf /var/data/pgsql /Volumes/data/pgsql
% ls -ald /var/data/pgsql
lrwxr-xr-x 1 root wheel 27 Nov 22 20:26 /var/data/pgsql -> /Volumes/data/pgsql
% ls -ald /Volumes/data/pgsql
drwxrwxr-x 12 testuser testuser 408 Nov 25 09:12 /Volumes/data/pgsql
% cd /var/data/pgsql
% pwd
/Volumes/data/pgsql
% sudo -u testuser /usr/local/pgsql/bin/initdb --pgdata=/var/data/pgsql
--username=testuser
IT CHOKES.
with:
could not identify current directory: Permission denied
could not identify current directory: Permission denied
could not identify current directory: Permission denied
The program "postgres" is needed by initdb but was not found in the
same directory as "initdb".
Check your installation.
(2)
% rm -rf /var/data/pgsql /Volumes/data/pgsql
% ls -ald /var
lrwxr-xr-x 1 root admin 11 Nov 23 10:28 /var -> private/var
% ls -ald /private/var
drwxr-xr-x 24 root wheel 816 Dec 3 14:51 /private/var
% cd /var
% pwd
/private/var
% sudo -u testuser /usr/local/pgsql/bin/initdb --pgdata=/var/data/pgsql
--username=testuser
IT WORKS.
% ls -ald /var/data/pgsql
drwx------ 12 testuser testuser 408 Dec 3 16:03 /var/data/pgsql
% ls /var/data/pgsql
PG_VERSION global pg_hba.conf pg_subtrans pg_xlog
base pg_clog pg_ident.conf pg_tblspc postgresql.conf
now, i'd guess that that indicates a problem with
(a) exec.c's getcwd,
(b) my understanding of the behavior of 'su' et al ..., and/or
(c) perms/ownership
*something* doesn't like being *in* a dir owned by testuser:testuser ...
fwiw, note also:
% niutil -read / /users/testuser
name: testuser
shell: /bin/tcsh
realname: Test User
uid: 57
gid: 57
change: 0
expire: 0
_shadow_passwd:
generateduid: 9ED08FE5-3755-11D9-8050-0025038BA5BD
authentication_authority: ;ShadowHash;
passwd: ********
% niutil -read / /groups/testuser
name: testuser
gid: 57
users: testuser root admin daemon
what've i missed?
cheers,
richard