[lug] where are mount directory permissions set?

Samartha qwerty at pobox.com
Tue Mar 21 18:51:51 MST 2000


I have a situation where a server program mounts a nfs file system from a 
Psion hand held computer under Linux over a serial line.

Originally, the directory to mount into has drwxrwxrwx root root, but after 
the mount it has  dr-x------ me users.

I am at a loss  where to change this - maybe it's some default of the nfs 
file system type. Also, I cant'f find any reference to the options 
"hard,intr" in mt.mnt_mntopts.

If somebody has a clue , please holler - thanks,

Samartha

The calling sequence is:

// set up rpc service
// create udp socket:

struct sockadr_in sain, kaddr;

sock = socket(AF)INET, SOCK_DGRAM, IPPROTO_UDP);
setsockopt ( sock, SOL_SOCKET, SO_RCVBUG, &bufsize, sizeof(bufsize));
bind ( sock, (struct sockadr *) &sain, sizeof  (*sain));

// mount the directory

int ksock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UPD);
bind (ksock, (struct sockaddr*) &kaddr, sizeof( kaddr));

   nfs_mount_data.version = NFS_MOUNT_VERSION;
   nfs_mount_data.fd      = ksock;
   nfs_mount_data.root    = *root_fh;    /* structure copy */
   nfs_mount_data.flags   = NFS_MOUNT_INTR | NFS_MOUNT_NOCTO;
   nfs_mount_data.rsize    = PBUFSIZE;
   nfs_mount_data.wsize    = PBUFSIZE;
   nfs_mount_data.timeo    = 600;
   nfs_mount_data.retrans  = 10;         /* default 3 */
   nfs_mount_data.acregmin = 3;          /* default 3 seconds */
   nfs_mount_data.acregmax = 60;         /* default 60 seconds */
   nfs_mount_data.acdirmin = 30;         /* default 30 seconds */
   nfs_mount_data.acdirmax = 60;         /* default 60 seconds */
   nfs_mount_data.addr     = sain;       /* structure copy */
   strcpy(nfs_mount_data.hostname, "localhost");

connect(ksock, (struct sockaddr *) &nfs_mount_data.addr, sizeof( 
nfs_mount_data.addr));


mount_flags = MS_MGC_VAL;

the flags in fs.h say nothing about rwx permissions t. b. set at mount time :

#define MS_RDONLY        1      /* Mount read-only */
#define MS_NOSUID        2      /* Ignore suid and sgid bits */
#define MS_NODEV         4      /* Disallow access to device special files */
#define MS_NOEXEC        8      /* Disallow program execution */
#define MS_SYNCHRONOUS  16      /* Writes are synced at once */
#define MS_REMOUNT      32      /* Alter flags of a mounted FS */
#define MS_MANDLOCK     64      /* Allow mandatory locks on an FS */
#define S_QUOTA         128     /* Quota initialized for 
file/directory/symlink */
#define S_APPEND        256     /* Append-only file */
#define S_IMMUTABLE     512     /* Immutable file */
#define MS_NOATIME      1024    /* Do not update access times. */
#define MS_NODIRATIME   2048    /* Do not update directory access times */


mount("nfs", dir, "nfs", mount_flags, &nfs_mount_data);

             struct mntent mnt;

             mnt.mnt_fsname = nfshost;
             mnt.mnt_dir = mntdir;
             mnt.mnt_type = "nfs";
             mnt.mnt_opts = "hard,intr";  <<-- here I added "rw" - no affect
             mnt.mnt_freq = mnt.mnt_passno = 0;

             if ((mfp = setmntent(MTAB_PATH, "a")))
               addmntent(mfp, &mnt);










More information about the LUG mailing list