Solved

Solaris : Permission Issue : Warning: cannot determine current directory

Posted on 2009-04-15
29
3,438 Views
Last Modified: 2013-12-27
Hi,

My solaris system has following issues :
$ pwd
cannot determine current directory
$ which java
Warning: cannot determine current directory
/usr/bin/java
$ cd ..
$ cd ..
$ cd ..
..: permission denied

The last pwd would go to /  but cd .. gives permission denied

However:
cd / is possible
$ ls -las
total 1096
   2 drwxr-xr-x  24 root     root        1024 Mar 11 19:50 .
   2 drwxr-xr-x  24 root     root        1024 Mar 11 19:50 ..

I have been comparing permissions on directories and can't find on first sight what might cause the "cannot determine" error.

Thanks,
Tim
0
Comment
Question by:thimerion
  • 12
  • 11
  • 5
  • +1
29 Comments
 
LVL 40

Expert Comment

by:omarfarid
ID: 24147838
what is user id? run

id

can you run

df -k
0
 
LVL 1

Author Comment

by:thimerion
ID: 24147891
$ id
uid=2515(timvds) gid=25000(customer)
$ df -k
Filesystem            kbytes    used   avail capacity  Mounted on
/dev/md/dsk/d4       18590017 3430485 14973632    19%    /
/proc                      0       0       0     0%    /proc
mnttab                     0       0       0     0%    /etc/mnttab
fd                         0       0       0     0%    /dev/fd
swap                 9430112      24 9430088     1%    /var/run
swap                 9435320    5232 9430088     1%    /tmp
/dev/md/dsk/d7       45656321  509102 44690656     2%    /cust
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 24147935
have you tried to see what are the permissions of the current dir?

ls -la

Try to login as root and see what are the permissions on the dir you are in now since it could be that you changed the perms and removed the read and execute ( r & x) from this dir
0
 
LVL 1

Author Comment

by:thimerion
ID: 24148016
$ pwd
cannot determine current directory
$ which java
Warning: cannot determine current directory
/usr/bin/java
$ ls -la
total 34
drwx--x---   2 mzlbzl   customer     512 Apr 15 13:50 .
drwxr-xr-x  13 root     root         512 Apr 14 13:48 ..
-rw-------   1 mzlbzl   customer      50 Apr 15 13:50 .Xauthority
-rw-------   1 root     other        101 Apr  6 16:09 .bash_history
-rw-r--r--   1 root     other         11 Apr  6 16:08 .profile
-rw-------   1 mzlbzl   customer   10532 Apr 15 13:50 .sh_history
-rwxr-xr-x   1 mzlbzl   customer      11 Apr 15 13:20 testscript.sh
$ pwd
cannot determine current directory
$
$ cd ..
$ ls -la
total 26
drwxr-xr-x  13 root     root         512 Apr 14 13:48 .
drwxr-xr-x   8 root     root         512 Apr 14 13:40 ..
$ ls -la
./..: Permission denied
total 28
drwxr-xr-x   8 root     root         512 Apr 14 13:40 .
drwxr-xr-x  13 root     root         512 Apr 14 13:48 home
$ cd /
$ ls -la
total 1096
drwxr-xr-x  24 root     root        1024 Mar 11 19:50 .
drwxr-xr-x  24 root     root        1024 Mar 11 19:50 ..

The directory I was in was /cust/home/timvds
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 24148086
your user is timvds and group is customer

drwx--x---   2 mzlbzl   customer     512 Apr 15 13:50 .

the dir you are in is owned by user mzlbzl and wner group is customer

the group has search but no read on the dir and others no perms.

can you login as root and see what are perms on / dir
0
 
LVL 1

Author Comment

by:thimerion
ID: 24148155
# cd /
# ls -la
total 1096
drwxr-xr-x  24 root     root        1024 Mar 11 19:50 .
drwxr-xr-x  24 root     root        1024 Mar 11 19:50 ..

changed to user mzlbzl, got same issue there ...
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 24148736
Can you restate the problem? I got confused :)
0
 
LVL 1

Author Comment

by:thimerion
ID: 24148807
$  cd / ; /usr/bin/pwd
/
$  cd /cust ; /usr/bin/pwd
pwd: cannot determine current directory!
$ cd /cust/home  ; /usr/bin/pwd
pwd: cannot determine current directory!
$ cd /cust/home/mzlbzl  ; /usr/bin/pwd
pwd: cannot determine current directory!
$ ls -ld /                                  
drwxr-xr-x  24 root     root        1024 Mar 11 19:50 /
$ ls -ld /cust
drwxr-xr-x   8 root     root         512 Apr 14 13:40 /cust
$ ls -ld /cust/home
drwxr-xr-x  13 root     root         512 Apr 14 13:48 /cust/home
$ ls -ld /cust/home/mzlbzl
drwx--x---   2 mzlbzl   customer     512 Apr 15 13:50 /cust/home/mzlbzl
$

Found on a techical forum that it could be the permissions of the mountpoint ...

Possible solution:
cd /
umount <mountpoint>
chmod 755 <mountpoint>
mount <mountpoint>
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 24148836
what is your shell? can you run commands

set
env
alias
0
 
LVL 22

Expert Comment

by:blu
ID: 24149930
The "cannot determine" means that some directory in the path to the current directory cannot be read by the user, that is
does not have read permissions. Try this:

ls -ld .
ls -ld ..
ls -ld ../..
ls -ld ../../
ls -ld ../../..
ls -ld ../../../..

and so on. Eventually you will find one that will not have read permissions set. After that one, further "ls -ld"'s at higher
levels will fail as well. Keep in mind that if the directory is on NFS or kerberized, the user may need the directory to
be world readable even if he is the owner, if his creds over the network are not correct. There also may be ACL's in
play here.
0
 
LVL 1

Author Comment

by:thimerion
ID: 24155596
Logged on as mzlbzl, started in directory /cust/home/mzlbzl

$ ls -ld .
drwx--x---   2 mzlbzl   customer     512 Apr 16 08:21 .
$ ls -ld ..
drwxr-xr-x  15 root     root         512 Apr 15 16:11 ..
$ ls -ld ../..
drwxrwxr-x   9 root     root         512 Apr 15 16:49 ../..
$ ls -ld ../../
drwxrwxr-x   9 root     root         512 Apr 15 16:49 ../../
$ ls -ld ../../..
../../..: Permission denied
$ ls -ld ../../../..
../../../..: Permission denied

Logged on as root
# cd /cust/home/mzlbzl
# ls -ld ../../..
drwxr-xr-x  24 root     root        1024 Mar 11 19:50 ../../..
#

It doesn't make sense!

Tim
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 24155640
root has full priv. can you tell if you use ls in /usr/bin or some other ls

can you do

which ls

0
 
LVL 1

Author Comment

by:thimerion
ID: 24155679
$ which ls
Warning: cannot determine current directory
/usr/bin/ls
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 24156056
I think it could be related to your shell prompt setting

can you check if you are setting your shell prompt some how? What sell are you using?
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 1

Author Comment

by:thimerion
ID: 24156231
shell is /bin/sh , changing that to /bin/ksh did not help
not setting my prompt  (even have nothing in the .profile)

Looking again at mount point permissions.

Tim
0
 
LVL 22

Expert Comment

by:blu
ID: 24156679
Okay, as root, do this:

cd /cust/home/mzlbzl
cd ../..
ls -lFai
df .
cd ..
ls -lFai
df .
cd /
ls -lFai
df .

Then do the same thing as the user, and post the output to both. Also, if the user fails when you do the cd ..,
do this as the user as well:

truss -ae -vall cd ..

and post the output.
0
 
LVL 1

Author Comment

by:thimerion
ID: 24156894
As root :
# cd /cust/home/mzlbzl
# cd ../..
# ls -lFai
total 32
         2 drwxrwxr-x   9 root     root         512 Apr 15 16:49 ./
         2 drwxr-xr-x  24 root     root        1024 Mar 11 19:50 ../
        28 drwx------   2 bea      bea          512 Apr 14 13:40 bea/
        29 drwx------   2 bea      bea          512 Apr 14 13:40 beaapp/
         5 drwxr-xr-x  15 root     root         512 Apr 15 16:11 home/
        23 drwxrwxrwx   2 root     other        512 Apr 16 07:32 installFiles/
         3 drwx------   2 root     root        8192 Apr 28  2008 lost+found/
         4 drwx--x---   2 oracle   5000         512 Apr 28  2008 oracle/
        47 drwxr-xr-x   2 prueba3  customer     512 Apr 15 16:49 prueba3/
# df .
/cust              (/dev/md/dsk/d7    ):90294392 blocks  5486537 files
# cd ..
# ls -lFai
total 1096
         2 drwxr-xr-x  24 root     root        1024 Mar 11 19:50 ./
         2 drwxr-xr-x  24 root     root        1024 Mar 11 19:50 ../
     90633 -rw-r--r--   1 root     other        693 Jul 16  2008 .cshrc
     90634 -rw-r--r--   1 root     other          0 Jul 16  2008 .cshrc.JASS.20080716122831
     88284 -rw-r--r--   1 root     other        489 Sep  5  2008 .g
     90635 -rw-r--r--   1 root     other        376 Jul 16  2008 .profile
     90636 -rw-r--r--   1 root     other          0 Jul 16  2008 .profile.JASS.20080716122831
     88280 -rw-------   1 root     other        764 Apr 24  2008 .sh_history
      2263 lrwxrwxrwx   1 root     root           9 Apr 24  2008 bin -> ./usr/bin/
    137452 drwxrwxr-x   9 root     root         512 Apr 15 16:49 cust/
...
# df .
/                  (/dev/md/dsk/d4    ):30318988 blocks  2094358 files
# cd /
# ls -lFai
total 1096
         2 drwxr-xr-x  24 root     root        1024 Mar 11 19:50 ./
         2 drwxr-xr-x  24 root     root        1024 Mar 11 19:50 ../
     90633 -rw-r--r--   1 root     other        693 Jul 16  2008 .cshrc
     90634 -rw-r--r--   1 root     other          0 Jul 16  2008 .cshrc.JASS.20080716122831
     88284 -rw-r--r--   1 root     other        489 Sep  5  2008 .g
     90635 -rw-r--r--   1 root     other        376 Jul 16  2008 .profile
     90636 -rw-r--r--   1 root     other          0 Jul 16  2008 .profile.JASS.20080716122831
     88280 -rw-------   1 root     other        764 Apr 24  2008 .sh_history
      2263 lrwxrwxrwx   1 root     root           9 Apr 24  2008 bin -> ./usr/bin/
    137452 drwxrwxr-x   9 root     root         512 Apr 15 16:49 cust/
# df .
/                  (/dev/md/dsk/d4    ):30318988 blocks  2094358 files
0
 
LVL 1

Author Comment

by:thimerion
ID: 24156939
$ cd /cust/home/mzlbzl
$ cd ../..
$ ls -lFai
./..: Permission denied
total 30
         2 drwxrwxr-x   9 root     root         512 Apr 15 16:49 ./
        28 drwx------   2 bea      bea          512 Apr 14 13:40 bea/
        29 drwx------   2 bea      bea          512 Apr 14 13:40 beaapp/
         5 drwxr-xr-x  15 root     root         512 Apr 15 16:11 home/
        23 drwxrwxrwx   2 root     other        512 Apr 16 07:32 installFiles/
         3 drwx------   2 root     root        8192 Apr 28  2008 lost+found/
         4 drwx--x---   2 oracle   5000         512 Apr 28  2008 oracle/
        47 drwxr-xr-x   2 prueba3  customer     512 Apr 15 16:49 prueba3/
$ df .
df: cannot canonicalize .: Permission denied
$

$ cd ..
..: permission denied
$ ls -lFai
./..: Permission denied
total 30
         2 drwxrwxr-x   9 root     root         512 Apr 15 16:49 ./
        28 drwx------   2 bea      bea          512 Apr 14 13:40 bea/
        29 drwx------   2 bea      bea          512 Apr 14 13:40 beaapp/
         5 drwxr-xr-x  15 root     root         512 Apr 15 16:11 home/
        23 drwxrwxrwx   2 root     other        512 Apr 16 07:32 installFiles/
         3 drwx------   2 root     root        8192 Apr 28  2008 lost+found/
         4 drwx--x---   2 oracle   5000         512 Apr 28  2008 oracle/
        47 drwxr-xr-x   2 prueba3  customer     512 Apr 15 16:49 prueba3/
$ df .
df: cannot canonicalize .: Permission denied
$ cd /

$ cd /
$ ls -lFai
total 1096
         2 drwxr-xr-x  24 root     root        1024 Mar 11 19:50 ./
         2 drwxr-xr-x  24 root     root        1024 Mar 11 19:50 ../
     90633 -rw-r--r--   1 root     other        693 Jul 16  2008 .cshrc
     90634 -rw-r--r--   1 root     other          0 Jul 16  2008 .cshrc.JASS.20080716122831
     88284 -rw-r--r--   1 root     other        489 Sep  5  2008 .g
     90635 -rw-r--r--   1 root     other        376 Jul 16  2008 .profile
     90636 -rw-r--r--   1 root     other          0 Jul 16  2008 .profile.JASS.20080716122831
     88280 -rw-------   1 root     other        764 Apr 24  2008 .sh_history
      2263 lrwxrwxrwx   1 root     root           9 Apr 24  2008 bin -> ./usr/bin/
    137452 drwxrwxr-x   9 root     root         512 Apr 15 16:49 cust/
...
$ df .
/                  (/dev/md/dsk/d4    ):30318988 blocks  2094358 files

0
 
LVL 40

Expert Comment

by:omarfarid
ID: 24157047
there is a common problem among all these commands, although it is showing perm denied, it is showing results ! and this is the case regardless of the command.
0
 
LVL 1

Author Comment

by:thimerion
ID: 24157113
truss
outputR.txt
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 24157114
can you tell us what you have in /etc/profile and user .profile files?
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 24157157
the file shows that it is running ksh !
0
 
LVL 22

Expert Comment

by:blu
ID: 24157193
Well. the problem seems to be specifically in the ".." (dotdot) entry of the directory at /cust.

Since this is a mount point, the .. entry has a certain amount of kernel magic in it. Check the /var/adm/messages file
for any indication of some kind of error when you try to access the .. link.

Also, do this. Both as root and as the user, cd into /cust and execute this command:
truss -vall ls -ld ..

Post the output to both.
0
 
LVL 1

Author Comment

by:thimerion
ID: 24157236
But what do you think of my thought that it are the permissions of the mounting point directory when it is not mounted.

I read everywhere they have to be 775 and you can't see them if the filesys is mounted.

I only do not know how to unmount the system and mount it again.  That I have to ask the sysadmin I guess.

Regards,
Tim
0
 
LVL 22

Expert Comment

by:blu
ID: 24157238
Sorry, I didn't see the truss you already posted. I think that your supposition above is correct. The directory underneath the mountpoint had too restrictive permissions. You should do what you said above, umount,chmod,mount.
0
 
LVL 40

Assisted Solution

by:omarfarid
omarfarid earned 25 total points
ID: 24157286
but I think the mount dir take the perms of the root dir of the file system when mounted !
0
 
LVL 22

Assisted Solution

by:blu
blu earned 25 total points
ID: 24157402
If course, it should, but that is a known issue with Solaris.

Yes, if you do not know how to unmount and remount the directory, then by all means get the admin to do it.
0
 

Expert Comment

by:z670193
ID: 24186661
try your own suggestion of unmounting and mounting to see if it helps as below:
#cd /
#umount /cust
#chmod 777 cust
#mount /cust

now try your stuffs.
0
 
LVL 1

Accepted Solution

by:
thimerion earned 0 total points
ID: 24192688
I have raised a case with the system engineer ...

I don't know with what parms the /cust is mounted so I might break it if I do that ...

Tim
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now