[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

NFS expert, please diagnose this



I've mailed to debian-user twice earlier about this but I haven't
gotten any responses at all.

If you know NFS, please try this an tell me if it works for you or
not.

As it doesn't work for me and I think it wont work for you, I suppose
I'd file a bug report but I don't know if it's the nfsd, libc, atd or
some other package that isn't doing what it should. 

Appearently, stat-ing a file in a directory that is only readable for
root from a program that is setuid root, that is on a nfs mounted
partition fails.

Here are some version that might be relevant (please ask if you need
another package's version number):

base,	1.1.0-14
libc5,	5.4.33-3
at,	3.1.7-3


Of course, if you need more information, I'll gladly supply it.


Thanks,

							MartinS


Here follows the major part of my last posting on this subject:

In the appended program, make sure that FILE_IN_LOCAL_UNREAD_AND_UNEXEC_DIR
points to a LOCAL file that is in a directory which is only readable
for root.
Likewise, make sure that FILE_IN_NFS_UNREAD_AND_UNEXEC_DIR points to a
file that is in a partition that is NFS MOUNTED that is in a directory
which is only readable for root (/var/spool/cron/atjobs/.SEQ is
perfect if you have it NFS mounted).

Compile the program ("gcc -o st st.c"), "chown daemon.daemon st" and
"chmod u+s st". Then run it as an ordinaty user.

At me it is like this (/boot is a local directory and /var is nfs
mounted):
kant# ls -al /boot/no
total 2
drwx------   2 daemon   daemon       1024 Sep 22 00:54 .
drwxr-xr-x   4 root     root         1024 Sep 22 00:52 ..
-rw-------   1 daemon   daemon          0 Sep 22 00:54 a
kant# ls -la /var/spool/cron/atjobs/
total 6
drwx------   2 daemon   daemon       1024 Sep 22 00:58 .
drwxr-xr-x   5 root     root         1024 Feb 19  1997 ..
-rw-------   1 daemon   daemon          6 Sep 22 00:42 .SEQ
[Some other files (jobs) removed.]

Running this program as an ordinary user (NOT root) I get:
kant:/var/tmp> ./st
stat("/boot/no/a" successful.
stat("/var/spool/cron/.SEQ" unsuccessful.


Now I hope somebody can test this and report if they have the same
problem.

Then there's the question: what's wrong? Is it a nfs problem? Can
anybody tell me?


----- Start of st.c -----
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>

#define FILE_IN_LOCAL_UNREAD_AND_UNEXEC_DIR "/boot/no/a"
#define FILE_IN_NFS_UNREAD_AND_UNEXEC_DIR "/var/spool/cron/.SEQ"

main(void)
{
  struct stat statbuf;

  if(stat(FILE_IN_LOCAL_UNREAD_AND_UNEXEC_DIR, &statbuf) == 0
     )
  {
    fprintf(stderr, "stat(\"" FILE_IN_LOCAL_UNREAD_AND_UNEXEC_DIR "\" successful.\n");
  }
  else
  {
    fprintf(stderr, "stat(\"" FILE_IN_LOCAL_UNREAD_AND_UNEXEC_DIR "\" unsuccessful.\n");
  }

  if(stat(FILE_IN_NFS_UNREAD_AND_UNEXEC_DIR, &statbuf) == 0
     )
  {
    fprintf(stderr, "stat(\"" FILE_IN_NFS_UNREAD_AND_UNEXEC_DIR "\" successful.\n");
  }
  else
  {
    fprintf(stderr, "stat(\"" FILE_IN_NFS_UNREAD_AND_UNEXEC_DIR "\" unsuccessful.\n");
  }

  return(0);

}
----- End of st.c -----


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: