cannot determine current directory


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users cannot determine current directory
# 8  
Old 11-08-2006
Let's say that when in /home/fred you cannot run pwd. Do:
ls -ld /
ls -ld /home
ls -ld /home/fred

and

cd / ; /usr/bin/pwd
cd /home ; /usr/bin/pwd
cd /home/fred ; /usr/bin/pwd

and you should be able to see where the problem is. You need read and search permission on all directories down to / to run a pwd.
# 9  
Old 11-10-2006
unmount the filesystem
chmod 755 the mount point
remount the filesystem

ie:
If the problem was with /home/applications I would.
Code:
cd /
umount /home/applications
chmod 755 /home/applications
mount /home/applications

Tornado
# 10  
Old 11-12-2006
Hi Perderabo

Following is the o/p after executing the commands. BUT I couldn't find where the problem is. How should I know what the problem is.

I logged is as tibco user id.

tibco@kplus_int [/home/applications] > man ls
getcwd: Permission denied
tibco@kplus_int [/home/applications] > ls -ld /
drwxr-xr-x 29 root root 1024 Nov 8 16:02 /
tibco@kplus_int [/home/applications] > ls -ld /home
drwxr-xr-x 25 root root 512 Oct 9 10:57 /home
tibco@kplus_int [/home/applications] > ls -ld /home/applications
drwxrwxr-x 4 tibco tibco 512 May 7 2003 /home/applications
tibco@kplus_int [/home/applications] > cd /;/usr/bin/which ls
/usr/bin/ls
tibco@kplus_int [/] > cd -
/home/applications
tibco@kplus_int [/home/applications] > cd /
tibco@kplus_int [/] > cd /home;/usr/bin/which ls
/usr/bin/ls
tibco@kplus_int [/home] > cd /home/applications;/usr/bin/which ls
Warning: cannot determine current directory
/usr/bin/ls
tibco@kplus_int [/home/applications] >

Thanks
axes
# 11  
Old 11-12-2006
Java

I hate to seem picky, but I asked for "cd /; /usr/bin/pwd". You somehow changed that to "cd /; /usr/bin/which ls". In this case that was good enough to determine where the problem is. But you need to follow directions more closely. A wild fumble can be disasterous. Note that
cd /home;/usr/bin/which ls
succeeded. But then
cd /home/applications;/usr/bin/which ls
failed. This is the clue that the problem is indeed which /home/applications. You need to follow the procedure that Tornado gave. But follow it exactly.

This is really a bug in Solaris. In every other Unix version the permissions on the hidden mountpoint do not matter. But it has been this way for years and Sun does not seem inclined to fix it.
# 12  
Old 11-12-2006
Hi Perderabo

It seems U have mistaken me. 'pwd' command is working fine in all the directories that's why I chose 'which' command so that I can better explain the errorneous situation.

If U observe all my postings, From the beginning(2nd posting), I knew that the culprit is /home/applications and its subdirs. BUT when I checked the perms, everything seems O.K.

So, I couldn't pin point where exactly the prob. is. I don't know that it is a BUG in solaris.

Anyway thanks 4 all ur suggestions.
axes
# 13  
Old 11-12-2006
pwd != /usr/bin/pwd

The shell's internal pwd is not useful in this case.
# 14  
Old 11-13-2006
U r correct, I checked with /usr/bin/pwd.

If U don't mind, Can U throw some more light on the foll.

In which situations,we get this error (cannot determine current directory!), Bec'se perms seems O.K. on all dirs down to /.
axes
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Current working directory

Hi all, How do I print the name of my current working directory only to screen? Not pwd! For example, if I was in /home/work I am looking for 'work' only (4 Replies)
Discussion started by: jimjam
4 Replies

2. UNIX for Advanced & Expert Users

current directory in awk

Hello, I want to use the string with the current directory in my awk command. I tried: 'pwd=system("pwd")' but it doesn't work. can please help somebody? (2 Replies)
Discussion started by: daWonderer
2 Replies

3. Shell Programming and Scripting

How to determine if there's a file in directory!

Hi All, I'm just wondering how can i determined if there's a file in directory and put it in a logs? dir="/home/test/" Please advise, Thanks, Use code tags, thanks. (1 Reply)
Discussion started by: nikki1200
1 Replies

4. Shell Programming and Scripting

tarball of current directory

I wanna make a backup tarball. I wanna write a script that makes tarball of the current directory. There are lots of files so I cant type all files, I wanna make the tarball by excluding few files. Like there 1000 files in a directory I wanna create a tarball containing 98 files of that... (1 Reply)
Discussion started by: nishrestha
1 Replies

5. UNIX for Dummies Questions & Answers

Determine FULL name of current script

Hi everyone, Is there a slick way to determine the FULL name of a script that is running? The variable ${0} just gives the relative path name. I guess I could just do the following: FULL_SCRIPT_NAME=${PWD}${0}Although that's pretty simple is there another way that I am missing? ... (4 Replies)
Discussion started by: msb65
4 Replies

6. Shell Programming and Scripting

[Perl] Determine directory name

Hi there, I wonder if it is possible the determine a name of a directory which is different on various hosts. Let me try to explain. I have the directory /tmp/dir1/dir2/canchangedir. This directory name is different on various hosts. I need to use the directory name, independent from the... (2 Replies)
Discussion started by: ejdv
2 Replies

7. Shell Programming and Scripting

Finding files in current directory when 100,000's files in current directory

Hi All I was wondering what is the most efficient way to find files in the current directory(that may contain 100,000's files), that meets a certain specified file type and of a certain age. I have experimented with the find command in unix but it also searches all sub directories. I have... (2 Replies)
Discussion started by: kewong007
2 Replies

8. UNIX for Advanced & Expert Users

How Can I Easily Determine If A File Has been Added to a Directory

I am uploading files that need to be processed prior to uploading. I will put the files in a directory. My question is how can I write an easy process to kick off a script once a file has been added? Is there an easy way to determine if a file has been added to a directory? Thanks (7 Replies)
Discussion started by: goodmis
7 Replies

9. UNIX for Dummies Questions & Answers

How Can I Easily Determine If A File Has been Added to a Directory

I am uploading files that need to be processed prior to uploading. I will put the files in a directory. My question is how can I write an easy process to kick off a script once a file has been added? Is there an easy way to determine if a file has been added to a directory? Thanks (1 Reply)
Discussion started by: goodmis
1 Replies

10. Shell Programming and Scripting

determine owner directory permissions from within the directory

From within a directory, how do I determine whether I have write permission for it. test -w pwd ; echo ? This doesn't work as it returns false, even though I have write permission. (4 Replies)
Discussion started by: Sniper Pixie
4 Replies
Login or Register to Ask a Question