1832997 Members
2387 Online
110048 Solutions
New Discussion

find command strangeness

 
SOLVED
Go to solution
Jim Mickens
Frequent Advisor

find command strangeness

Having an issue with using the find command. When using the following command, root can find the files with no problem, but when a standard user tries the command, nothing is found.

find ./ -name *.zip.Z

root will come up with the files, but I get no match when a standard user tries the command.

I use this in a script that is compressing and entire directory and then goes back to find any .zip.Z files in the subdirs and uncompresses them (because they became bigger when compress). The script has the system bit turned on so that it runs as root, but the command still doesn't work when run by a standard user. The files are all rw accessible by everyone.

Any ideas as to why this happens or how to get around it would be appreciated.
6 REPLIES 6
Patrick Wallek
Honored Contributor
Solution

Re: find command strangeness

In this case you really should be quoting the name.

See if this helps:

find ./ -name "*.zip.Z"
Abdul Rahiman
Esteemed Contributor

Re: find command strangeness

Guess, may be the user is running from wrong directory ??
# find -name "*.zip.Z" -print

No unix, no fun
Muthukumar_5
Honored Contributor

Re: find command strangeness

hai,

By using standard users, we can not find the files in privillaged directories. You will get find: cannot open directory error's

Check the directories permission. Standard may not have the permission to search in that. change the directory permission to allow the standard users to search in that.

Easy to suggest when don't know about the problem!
Jim Mickens
Frequent Advisor

Re: find command strangeness

That seems to work from the user account. I'll put it in the script. Hadn't thought of that. Thanks!
Jim Mickens
Frequent Advisor

Re: find command strangeness

So many answers so quickly!

To clarify my previous - using the quotes to do the find appears to be the answer to my problem. The files and directories involved are all rw for all users, so priveleges are not the problem.
Muthukumar_5
Honored Contributor

Re: find command strangeness

i have a example to process my view.

newconfig directory as,
dr-x------ 3 root bin 96 Jul 15 22:07 newconfig

with test.zip.Z file
-rw-rw-rw- 1 root sys 9 Jul 15 22:07 test.zip.Z

Now check the find command,

root> find /opt/hpwebadmin/newconfig/ -name *.zip.Z -exec ll {} \;
-rw-rw-rw- 1 root sys 9 Jul 15 22:07 /opt/hpwebadmin/newconfig/test.zip.Z


Standard user> find /opt/hpwebadmin/newconfig/ -name *.zip.Z -exec ll {} \;
find: cannot open /opt/hpwebadmin/newconfig

So *.zip.Z without "

Move the test.zip.Z to /tmp (drwxrwxrwt permission) then search it as,

user> find /tmp -name *.zip.Z -exec ll {} \;
-rw-rw-rw- 1 root sys 9 Jul 15 22:07 /tmp/test.zip.Z

Generally, some directories are not having permission to allow the standard users for searching.

Easy to suggest when don't know about the problem!