1 Reply Latest reply: Nov 26, 2013 12:23 PM by Steve.Clamage-Oracle RSS

    mount() returns not owner

    Dave-Raytheon Company


      I can successfully make a system call to mount a windows share as a specfic user 'ttp' using the following source.

       

      system("mount -F smbfs //chaos.cih-ettm.com/InboundImages /export/home/ttp/images");

       

      However I would like better control over this and therefore I'm trying to call the system mount function with the following code and it always returns '-1 Not owner' however the user is the owner of the directory /export/home/ttp/images. Any help would be greatly appreciated.

       

      #include <sys/types.h>
      #include <sys/mount.h>
      #include <sys/mntent.h>
      #include <errno.h>

      #include <iostream>
      #include <string>

      using namespace std;

      int main()
      {
              char spec[] = "//chaos.cih-ettm.com/InboundImages";
              char dir[] = "/export/home/ttp/images";
              char opt[] = "rw,xattr";
              char options[MAX_MNTOPT_STR] =   { 0 };
              strcpy(options,opt);
              int ret = 0;
              ret = mount(spec, dir, MS_OPTIONSTR , MNTTYPE_SMBFS,0,0,options, MAX_MNTOPT_STR);
              cout << "returned value: " << ret << " " << strerror(errno) << endl;
              return 0;

      }

       

      Thanks,

      Dave