Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Feb 1999 17:34:40 -0800 (PST)
From:      Anthony Rho <anthonyrh@yahoo.com>
To:        freebsd-questions@FreeBSD.ORG
Subject:   error getting cwd when logging in as user
Message-ID:  <19990203013440.28239.rocketmail@send501.yahoomail.com>

next in thread | raw e-mail | index | archive | help
Hello,

I have recently had to transfer all of our home users's directories to
another machine due to some restructuring in our sysytem methodology. 
Here's how I did it; I'll try to be as (superflously) detailed as
possible, so please bare with me :)

First, the partition information for both FreeBSD 2.2.6 machines
(mach1 and mach2) - we basically setup four partitions, each mounted
on /, /usr, /var and of course the last is for swap.

On the older machine (mach1), I did these NFS commands:

mount -t nfs mach2:/ /mnt/mach1/
mount -t nfs mach2:/usr /mnt/mach1/usr/
mount -t nfs mach2:/var /mnt/mach1/var/

I then did these cpio commands:

cd /usr
find . -print | cpio --verbose -p --make-directories
--preserve-modification-time --unconditional /mnt/mach1/usr
cd /var
find . -print | cpio --verbose -p --make-directories
--preserve-modification-time --unconditional /mnt/mach1/var

The file transfer went well (I haven't noticed any file corruption),
so I proceeded with bringing over the necessary /etc/ files - passwd,
group, and master.passwd.  We use stock login.access and login.conf
configurations, so we left these alone.

Once these were copied over, I ran vipw and made a small change to a
user's realname and saved and exited (to rebuild the pw database). 
Much later during this ordeal, I ended up deleting the /etc/*pwd.db
files and ran pwd_mkdb.

Now the problem :)

If I login as a normal user, I get this error:

shell-init: could not get current directory: getcwd: cannot access
parent directories
job-working-directory: could not get current directory: getcwd: cannot
access parent directories
[user@mach2 .]$ 

Doing an ls:

[user@mach2 .]$ ls
..lots of files listed correctly..

Doing a pwd:

[user@mach2 .]$ pwd 
pwd: could not get current directory: getcwd: cannot access parent
directories

Finally, a cd (and another ls and pwd):

[user@mach2 .]$ cd
cd_links: could not get current directory: getcwd: cannot access
parent directories
[user@mach2 ~]$ ls
..lots of files listed correctly..
[user@mach2 ~] pwd
/usr/www/user

Note the change from '.' to '~' in the cwd field of the prompt.

user's home directory is /usr/www/user, so this shouldn't be related
to the /home -> /usr/home symlink.  The directory permissions up to
this directory are 755, owned by root and group owned by wheel.  The
relevant /etc files are 644/00 (passwd|group/master.passwd).

Other symptoms:

I temporarily changed user's home directory to point to other
directories under /usr, only to get the same error.  I then changed
user's home directory to some locations in / and /var.. and guess
what?  The user can login normally without the error!  This leads me
to believe that maybe the /usr partition is not being mounted
properly, so here's my /etc/fstab:

bash-2.01# cat /etc/fstab
# Device Mountpoint FStype Options Dump Pass#
/dev/sd0s1b none    swap   sw      0       0
/dev/sd0s1a /       ufs    rw      1       1
/dev/sd0s1f /usr    ufs    rw      2       2
/dev/sd0s1e /var    ufs    rw      2       2
proc        /proc   procfs rw      0       0

..which of course looks normal.

*phew* I think that's it.  A simple 'cd' seems to fix it, but
unfortunateley this does not work for CGIs that the webserver depends
on - they end up failing.  Many thanks to anyone who can figure out
what might be going wrong :)

Take care
Anthony
_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990203013440.28239.rocketmail>