Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 11576
  • Last Modified:

df: cannot statvfs (mounting permission problems)

When I'm as root, I see all my partitions.   When I'm as test user, I get these errors

# df -k
Filesystem            kbytes    used   avail capacity  Mounted on
/proc                      0       0       0     0%    /proc
/dev/dsk/c0t0d0s0     963979   48229  857912     6%    /
/dev/dsk/c0t0d0s4    1984175  833739 1090911    44%    /usr
fd                         0       0       0     0%    /dev/fd
/dev/dsk/c0t0d0s1     721751  117039  546972    18%    /var
/dev/dsk/c0t0d0s5    3009655  397982 2551480    14%    /export
/dev/dsk/c0t0d0s6     963979   17016  889125     2%    /export/home
/dev/dsk/c0t0d0s7    8742181 7402003 1252757    86%    /opt
df: cannot statvfs /opt/test/1: Permission denied                                        <-------
df: cannot statvfs /opt/test/2: Permission denied                                        <-------
df: cannot statvfs /opt/test/3: Permission denied                                        <-------
/dev/dsk/c0t1d0s3     963979      21  906120     1%    /var/log

Also /opt looks mounted, but when I got there, I get a permission denied

# cd /opt
/opt: Permission denied

I have several such machines, and this is the only one giving me problems.  
/opt/test/1 /opt/test/2 /opt/test/3 are on a separate hard disk but that hard disk looks healthy when I type format

io1# more /etc/vfstab
#device         device          mount           FS      fsck    mount   mount
#to mount       to fsck         point           type    pass    at boot options
#/dev/dsk/c1d0s2 /dev/rdsk/c1d0s2 /usr          ufs     1       yes     -
fd      -       /dev/fd fd      -       no      -
/proc   -       /proc   proc    -       no      -
/dev/dsk/c0t0d0s3       -       -       swap    -       no      -
/dev/dsk/c0t0d0s0       /dev/rdsk/c0t0d0s0      /       ufs     1       no      -
/dev/dsk/c0t0d0s4       /dev/rdsk/c0t0d0s4      /usr    ufs     1       no      -
/dev/dsk/c0t0d0s1       /dev/rdsk/c0t0d0s1      /var    ufs     1       no      -
/dev/dsk/c0t0d0s5       /dev/rdsk/c0t0d0s5      /export ufs     2       yes     -
/dev/dsk/c0t0d0s6       /dev/rdsk/c0t0d0s6      /export/home    ufs     2       yes     -
/dev/dsk/c0t0d0s7       /dev/rdsk/c0t0d0s7      /opt    ufs     2       yes     -
/dev/dsk/c0t1d0s1       /dev/rdsk/c0t1d0s1      /opt/test/1 ufs     2       yes     -
/dev/dsk/c0t1d0s0       /dev/rdsk/c0t1d0s0      /opt/test/2       ufs     2       yes     -
/dev/dsk/c0t1d0s4       /dev/rdsk/c0t1d0s4      /opt/test/3      ufs     2       yes     -
/dev/dsk/c0t1d0s3       /dev/rdsk/c0t1d0s3      /var/log        ufs     2       yes     -

Searching for disks...done
       0. c0t0d0 <FUJITSU-0112 cyl 10498 alt 2 hd 8 sec 425>
       1. c0t1d0 <FUJITSU-0112 cyl 10498 alt 2 hd 8 sec 425>

Anyone knows what the problem may be here??  Or some suggestions where I could check??
  • 7
  • 4
  • 4
  • +1
2 Solutions
What are the permissions on /opt? It sounds like the mount point(s) might be owned by root and readable/executable only by root.
> df: cannot statvfs /opt/test/1: Permission denied                                        <-------
> df: cannot statvfs /opt/test/2: Permission denied                                        <-------
> df: cannot statvfs /opt/test/3: Permission denied                                        <-------
--- man statvfs ---
statvfs() fails if one or more of the following are true:
EACCES      Search permission is denied on  a  component of the path prefix.
So do
$ ls -al /opt/test/
to see the permission on those 3 mounted filesystems.
Maybe is not readable for "test user".

ROCK1972Author Commented:
Those 3 mounted filesystems have the test user permissions, and like I said, I have many of these machines and this is the only one, in 4 years, that's giving me this problem.  I'm suspecting someone has been screwing up with the permissions, or something else, but how do I fix it

/opt has directories belonging both to root and the test

And on all other machines I can go to to /opt/test/1 /opt/test/2 /opt/test/3 as test user no problem  **AND** when I 'su' I get those 3 filesystems mounted no problem and all 3 are with the test permissions!!

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

> have the test user permissions
Could you umount those /opt/test/1, /opt/test/2, and /opt/test/3 as root and "chmod 755 /opt/test/*"?
Then mount those 3 filesystem again.

ROCK1972Author Commented:
Here's another error message/weirdness...

# statvfs
/opt/test/statvfs: Permission denied  


And when I type some other commands, it gives me similar errors

ROCK1972Author Commented:
>Could you umount those /opt/test/1, /opt/test/2, and /opt/test/3 as root and "chmod 755 /opt/test/*"?
>Then mount those 3 filesystem again.

Sure. I'll do that, on those filesystems.  But .. the problems also lies in the /opt directory which *IS* mounted (take a look above) and is giving me permission problems, I cannot cd to /opt and /opt has both root and test user folders and I cannot just chown all of /opt as 'test' cause its gonna mess up my system...
ROCK1972Author Commented:
Ok, did what you asked wesly and no change... get the same "permission denied" when I try to cd to /opt
and /opt/test/1 /opt/test/2 /opt/test/3  
As root what does 'ls -ld /opt /opt/test /opt/test/*' show?
> "chmod 755 /opt/test/*"
Oops, should be
# chmod -R 755 /opt/test/*

Can you mount the disk to different dir, eg /mnt? If you can umount them and mount
them to a different dir, you can delete dir 1/2/3 under /opt/test, then remake the empty

If you still have problem, shutdown the system, use Solaris CD to boot up the box in single user mode, then run "fsck" to all filesystem

eg :
fsck -y  /dev/rdsk/c0txd0sx    
> shutdown the system, use Solaris CD to boot up the box in single user mode
For fsck, is it necessary to use CD to boot into single user mode?
Or in the "ok" prompt type in "boot -s" is enough? That's what I usually did.

When you have a system in unknow status, it is better to use Solaris CD to boot up to
single user mode. Of course, if you are positive about the OS filesystem, then you can
just do "boot -s". Just image the situation that / ( /dev/rdsk/c0t0d0s0 ), and you run
the fsck from the HD might not be able to fix your filesystem!.
I'm somewhat skeptical as to it being a file system problem since things behave proper for root. I'd still like to know what 'ls -ld /opt /opt/test /opt/test/*' shows because sounds very much like a permissions issue.
ROCK1972Author Commented:
Ok, the problem was the permissions on the /opt folder.  They were set to

drwxr-rr-r   2 root     root /opt

I'll give 1/2 of the points to wesly and 1/2 go jlevie. Thanks for the help guys!

ROCK1972Author Commented:
Ah,.  For some reason I was not able to split them... wesley, if you want ask the admin to contact me and Ill tell them to give you 1/2 of the points.  jlevie did have the solution from the start, i was wasn't paying attention!!!  Thanks guys!  
I thought that would be what the problem was.
ROCK1972Author Commented:
Thanks yuzh. I'll fix that now.

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 7
  • 4
  • 4
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now