pastebin - collaborative debugging tool
rovema.kpaste.net RSS


msnfs41client: Add dircreatemode=,filecreatemode= mount options, POSIX/ISO C octal mode, Windows Server 2019 NFSV4.1 server setup+misc, 2024-11-06
Posted by Anonymous on Wed 6th Nov 2024 14:56
raw | new post

  1. From 98db9c3f55b382a86a5fbcfe642c0e6a961a7393 Mon Sep 17 00:00:00 2001
  2. From: Roland Mainz <roland.mainz@nrubsig.org>
  3. Date: Wed, 6 Nov 2024 15:17:22 +0100
  4. Subject: [PATCH 1/3] mount,nfs41_build_features.h,sys: Add
  5.  dircreatemode=,filecreatemode= mount options+POSIX octal mode
  6.  
  7. 1. Add "dircreatemode=" and "filecreatemode=" mount options to set the
  8. default create mode for { files, dirs } indepedently.
  9. "createmode=" sets for both dirs+files
  10.  
  11. 2. Allow traditional POSIX/ISO C octual values (e.g. 0777, 0644 etc),
  12. as the "0o" prefix used by Windows was too confusing.
  13.  
  14. Example:
  15. $ /sbin/nfs_mount -o rw,dircreatemode=0750,filecreatemode=0640 N nfs://10.49.202.230//bigdisk
  16.  
  17. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  18. ---
  19. mount/mount.c            |  22 +++++-
  20.  nfs41_build_features.h   |   4 +-
  21.  sys/nfs41sys_driver.h    |  17 ++---
  22.  sys/nfs41sys_mount.c     | 140 +++++++++++++++++++++++++++++----------
  23.  sys/nfs41sys_openclose.c |  26 ++++++--
  24.  5 files changed, 157 insertions(+), 52 deletions(-)
  25.  
  26. diff --git a/mount/mount.c b/mount/mount.c
  27. index dafa9ef..db6f94c 100644
  28. --- a/mount/mount.c
  29. +++ b/mount/mount.c
  30. @@ -112,11 +112,24 @@ void PrintMountUsage(LPWSTR pProcess)
  31.          "\tnotimebasedcoherency\tturns off time-based coherency (default, due to bugs)\n"
  32.          "\twsize=#\twrite buffer size in bytes\n"
  33.          "\tcreatemode=\tspecify default POSIX permission mode\n"
  34. +            "\t\tfor new directories and files created on the NFS share.\n"
  35. +            "\t\tArgument is an octal value prefixed with '0' or '0o',\n"
  36. +            "\t\tif this value is prefixed with 'nfsv3attrmode+'\n"
  37. +            "\t\tthe mode value from a \"NfsV3Attributes\" EA will be used\n"
  38. +            "\t\t(defaults \"nfsv3attrmode+0%o\" for dirs and \n"
  39. +            "\t\t\"nfsv3attrmode+0%o\" for files).\n"
  40. +        "\tdircreatemode=\tspecify default POSIX permission mode\n"
  41. +            "\t\tfor new directories created on the NFS share.\n"
  42. +            "\t\tArgument is an octal value prefixed with '0' or '0o',\n"
  43. +            "\t\tif this value is prefixed with 'nfsv3attrmode+'\n"
  44. +            "\t\tthe mode value from a \"NfsV3Attributes\" EA will be used\n"
  45. +            "\t\t(defaults \"nfsv3attrmode+0%o\").\n"
  46. +        "\tfilecreatemode=\tspecify default POSIX permission mode\n"
  47.              "\t\tfor new files created on the NFS share.\n"
  48. -            "\t\tArgument is an octal value prefixed with '0o',\n"
  49. +            "\t\tArgument is an octal value prefixed with '0' or '0o',\n"
  50.              "\t\tif this value is prefixed with 'nfsv3attrmode+'\n"
  51.              "\t\tthe mode value from a \"NfsV3Attributes\" EA will be used\n"
  52. -            "\t\t(defaults \"nfsv3attrmode+0o%o\").\n"
  53. +            "\t\t(defaults \"nfsv3attrmode+0%o\").\n"
  54.  
  55.          "* URL parameters:\n"
  56.          "\tro=1\tmount as read-only\n"
  57. @@ -147,7 +160,10 @@ void PrintMountUsage(LPWSTR pProcess)
  58.          "\tnfs_mount.exe -o sec=sys S nfs://myhost1//dirwithspace/dir+space/test2?rw=1\n"
  59.          "\tnfs_mount.exe -o sec=sys nfs://myhost1//dirwithspace/dir+space/test2?rw=1\n",
  60.          pProcess, pProcess, pProcess, pProcess,
  61. -        (int)NFS41_DRIVER_DEFAULT_CREATE_MODE);
  62. +        (int)NFS41_DRIVER_DEFAULT_DIR_CREATE_MODE,
  63. +        (int)NFS41_DRIVER_DEFAULT_FILE_CREATE_MODE,
  64. +        (int)NFS41_DRIVER_DEFAULT_DIR_CREATE_MODE,
  65. +        (int)NFS41_DRIVER_DEFAULT_FILE_CREATE_MODE);
  66.  }
  67.  
  68.  
  69. diff --git a/nfs41_build_features.h b/nfs41_build_features.h
  70. index dfb144f..34843e1 100644
  71. --- a/nfs41_build_features.h
  72. +++ b/nfs41_build_features.h
  73. @@ -126,9 +126,11 @@
  74.  
  75.  /*
  76.   * Default POSIX permission mode bits for new files
  77. + * and directories.
  78.   * Can be ovrriden with a "NfsV3Attributes" EA
  79.   */
  80. -#define NFS41_DRIVER_DEFAULT_CREATE_MODE (0755)
  81. +#define NFS41_DRIVER_DEFAULT_DIR_CREATE_MODE (0755)
  82. +#define NFS41_DRIVER_DEFAULT_FILE_CREATE_MODE (0644)
  83.  
  84.  /*
  85.   * NFS41_DRIVER_DEBUG_FS_NAME - define which filesystem name should
  86. diff --git a/sys/nfs41sys_driver.h b/sys/nfs41sys_driver.h
  87. index ab52fb8..721815e 100644
  88. --- a/sys/nfs41sys_driver.h
  89. +++ b/sys/nfs41sys_driver.h
  90. @@ -299,6 +299,11 @@ nfs41_updowncall_list upcall, downcall;
  91.  #define MAX_SEC_FLAVOR_LEN              12
  92.  #define UPCALL_TIMEOUT_DEFAULT          50  /* in seconds */
  93.  
  94. +typedef struct _NFS41_MOUNT_CREATEMODE {
  95. +    BOOLEAN use_nfsv3attrsea_mode;
  96. +    DWORD mode;
  97. +} NFS41_MOUNT_CREATEMODE;
  98. +
  99.  typedef struct _NFS41_MOUNT_CONFIG {
  100.      BOOLEAN use_nfspubfh;
  101.      DWORD ReadSize;
  102. @@ -314,10 +319,8 @@ typedef struct _NFS41_MOUNT_CONFIG {
  103.      WCHAR sec_flavor_buffer[MAX_SEC_FLAVOR_LEN];
  104.      UNICODE_STRING SecFlavor;
  105.      DWORD timeout;
  106. -    struct {
  107. -        BOOLEAN use_nfsv3attrsea_mode;
  108. -        DWORD mode;
  109. -    } createmode;
  110. +    NFS41_MOUNT_CREATEMODE dir_createmode;
  111. +    NFS41_MOUNT_CREATEMODE file_createmode;
  112.  } NFS41_MOUNT_CONFIG, *PNFS41_MOUNT_CONFIG;
  113.  
  114.  typedef struct _nfs41_mount_entry {
  115. @@ -407,10 +410,8 @@ typedef struct _NFS41_V_NET_ROOT_EXTENSION {
  116.      FILE_FS_ATTRIBUTE_INFORMATION FsAttrs;
  117.      DWORD                   sec_flavor;
  118.      DWORD                   timeout;
  119. -    struct {
  120. -        BOOLEAN use_nfsv3attrsea_mode;
  121. -        DWORD mode;
  122. -    } createmode;
  123. +    NFS41_MOUNT_CREATEMODE  dir_createmode;
  124. +    NFS41_MOUNT_CREATEMODE  file_createmode;
  125.      USHORT                  MountPathLen;
  126.      BOOLEAN                 read_only;
  127.      BOOLEAN                 write_thru;
  128. diff --git a/sys/nfs41sys_mount.c b/sys/nfs41sys_mount.c
  129. index 8317980..76da602 100644
  130. --- a/sys/nfs41sys_mount.c
  131. +++ b/sys/nfs41sys_mount.c
  132. @@ -58,6 +58,7 @@
  133.  #include <winerror.h>
  134.  
  135.  #include <Ntstrsafe.h>
  136. +#include <stdbool.h>
  137.  
  138.  #include "nfs41sys_buildconfig.h"
  139.  
  140. @@ -309,8 +310,12 @@ void nfs41_MountConfig_InitDefaults(
  141.      Config->SecFlavor.Buffer = Config->sec_flavor_buffer;
  142.      RtlCopyUnicodeString(&Config->SecFlavor, &AUTH_SYS_NAME);
  143.      Config->timeout = UPCALL_TIMEOUT_DEFAULT;
  144. -    Config->createmode.use_nfsv3attrsea_mode = TRUE;
  145. -    Config->createmode.mode = NFS41_DRIVER_DEFAULT_CREATE_MODE;
  146. +    Config->dir_createmode.use_nfsv3attrsea_mode = TRUE;
  147. +    Config->dir_createmode.mode =
  148. +        NFS41_DRIVER_DEFAULT_DIR_CREATE_MODE;
  149. +    Config->file_createmode.use_nfsv3attrsea_mode = TRUE;
  150. +    Config->file_createmode.mode =
  151. +        NFS41_DRIVER_DEFAULT_FILE_CREATE_MODE;
  152.  }
  153.  
  154.  static
  155. @@ -506,10 +511,39 @@ NTSTATUS nfs41_MountConfig_ParseOptions(
  156.              else
  157.                  RtlCopyUnicodeString(&Config->SecFlavor, &usValue);
  158.          }
  159. -        else if (wcsncmp(L"createmode", Name, NameLen) == 0) {
  160. +        else if ((wcsncmp(L"createmode", Name, NameLen) == 0) ||
  161. +            (wcsncmp(L"dircreatemode", Name, NameLen) == 0) ||
  162. +            (wcsncmp(L"filecreatemode", Name, NameLen) == 0)) {
  163.  #define NFSV3ATTRMODE_WSTR L"nfsv3attrmode+"
  164.  #define NFSV3ATTRMODE_WCSLEN (14)
  165.  #define NFSV3ATTRMODE_BYTELEN (NFSV3ATTRMODE_WCSLEN*sizeof(WCHAR))
  166. +            bool set_dirmode = false;
  167. +            bool set_filemode = false;
  168. +
  169. +            switch(Name[0]) {
  170. +                case L'c':
  171. +                    set_dirmode = true;
  172. +                    set_filemode = true;
  173. +                    break;
  174. +                case L'd':
  175. +                    set_dirmode = true;
  176. +                    break;
  177. +                case L'f':
  178. +                    set_filemode = true;
  179. +                    break;
  180. +                default:
  181. +                    print_error("nfs41_MountConfig_ParseOptions: "
  182. +                        "invalid createmode name\n");
  183. +                    status = STATUS_INVALID_PARAMETER;
  184. +                    break;
  185. +            }
  186. +
  187. +#ifdef DEBUG_MOUNTCONFIG
  188. +            DbgP("nfs41_MountConfig_ParseOptions: "
  189. +                "set_dirmode=%d set_filemode=%d\n",
  190. +                (int)set_dirmode, (int)set_filemode);
  191. +#endif /* DEBUG_MOUNTCONFIG */
  192. +
  193.              if ((usValue.Length >= NFSV3ATTRMODE_BYTELEN) &&
  194.                  (!wcsncmp(NFSV3ATTRMODE_WSTR,
  195.                      usValue.Buffer,
  196. @@ -524,8 +558,10 @@ NTSTATUS nfs41_MountConfig_ParseOptions(
  197.                      "leftover option/usValue='%wZ'/%ld\n",
  198.                      &usValue, (long)usValue.Length);
  199.  #endif /* DEBUG_MOUNTCONFIG */
  200. -
  201. -                Config->createmode.use_nfsv3attrsea_mode = TRUE;
  202. +                if (set_dirmode)
  203. +                    Config->dir_createmode.use_nfsv3attrsea_mode = TRUE;
  204. +                if (set_filemode)
  205. +                    Config->file_createmode.use_nfsv3attrsea_mode = TRUE;
  206.              }
  207.              else {
  208.  #ifdef DEBUG_MOUNTCONFIG
  209. @@ -533,28 +569,51 @@ NTSTATUS nfs41_MountConfig_ParseOptions(
  210.                      "leftover option/usValue='%wZ'/%ld\n",
  211.                      &usValue, (long)usValue.Length);
  212.  #endif /* DEBUG_MOUNTCONFIG */
  213. -                Config->createmode.use_nfsv3attrsea_mode = FALSE;
  214. +                if (set_dirmode)
  215. +                    Config->dir_createmode.use_nfsv3attrsea_mode  = FALSE;
  216. +                if (set_filemode)
  217. +                    Config->file_createmode.use_nfsv3attrsea_mode = FALSE;
  218.              }
  219.  
  220. -            /*
  221. -             * Reject mode values not prefixed with "0o", as
  222. -             * |RtlUnicodeStringToInteger()| uses
  223. -             * 0o (e.g. "0o123") as prefix for octal values,
  224. -             * and does not understand the traditional
  225. -             * UNIX/POSIX/ISO C "0" (e.g. "0123") prefix
  226. -             */
  227. -            if ((usValue.Length >= (3*sizeof(WCHAR))) &&
  228. -                (usValue.Buffer[0] == L'0') &&
  229. -                (usValue.Buffer[1] == L'o')) {
  230. -                status = nfs41_MountConfig_ParseDword(Option,
  231. -                    &usValue,
  232. -                    &Config->createmode.mode, 0,
  233. -                    0777);
  234. +            if (usValue.Length >= (2*sizeof(WCHAR))) {
  235. +                ULONG parse_base = 0;
  236. +                ULONG cmode;
  237. +
  238. +                if ((usValue.Buffer[0] == L'0') &&
  239. +                    iswdigit(usValue.Buffer[1])) {
  240. +                    /*
  241. +                     * Parse input as traditional POSIX/C octal number
  242. +                     * |RtlUnicodeStringToInteger()| only supports
  243. +                     * "0o" prefix for |parse_base==0|, so we skip
  244. +                     * the leading '0' and set |parse_base| to octal
  245. +                     * mode.
  246. +                     */
  247. +                    usValue.Buffer++;
  248. +                    usValue.Length-=sizeof(WCHAR);
  249. +                    parse_base = 8;
  250. +#ifdef DEBUG_MOUNTCONFIG
  251. +                    DbgP("nfs41_MountConfig_ParseOptions: "
  252. +                        "parsing POSIX/C octal number\n");
  253. +#endif /* DEBUG_MOUNTCONFIG */
  254. +                }
  255. +
  256. +                status = RtlUnicodeStringToInteger(&usValue,
  257. +                    parse_base, &cmode);
  258.                  if (status == STATUS_SUCCESS) {
  259. -                    if (Config->createmode.mode > 0777) {
  260. +#ifdef DEBUG_MOUNTCONFIG
  261. +                    DbgP("nfs41_MountConfig_ParseOptions: createmode "
  262. +                        "parsed mode=0%o\n", (int)cmode);
  263. +#endif /* DEBUG_MOUNTCONFIG */
  264. +                    if (cmode > 0777) {
  265.                          status = STATUS_INVALID_PARAMETER;
  266.                          print_error("mode 0%o out of bounds\n",
  267. -                            (int)Config->createmode.mode);
  268. +                            (int)cmode);
  269. +                    }
  270. +                    else {
  271. +                        if (set_dirmode)
  272. +                            Config->dir_createmode.mode  = cmode;
  273. +                        if (set_filemode)
  274. +                            Config->file_createmode.mode = cmode;
  275.                      }
  276.                  }
  277.              }
  278. @@ -566,10 +625,13 @@ NTSTATUS nfs41_MountConfig_ParseOptions(
  279.  
  280.              DbgP("nfs41_MountConfig_ParseOptions: createmode: "
  281.                  "status=0x%lx, "
  282. -                "createmode=(use_nfsv3attrsea_mode=%d, mode=0%o\n",
  283. +                "dir_createmode=(use_nfsv3attrsea_mode=%d mode=0%o) "
  284. +                "file_createmode=(use_nfsv3attrsea_mode=%d mode=0%o)\n",
  285.                  (long)status,
  286. -                (int)Config->createmode.use_nfsv3attrsea_mode,
  287. -                (int)Config->createmode.mode);
  288. +                (int)Config->dir_createmode.use_nfsv3attrsea_mode,
  289. +                (int)Config->dir_createmode.mode,
  290. +                (int)Config->file_createmode.use_nfsv3attrsea_mode,
  291. +                (int)Config->file_createmode.mode);
  292.          }
  293.          else {
  294.              status = STATUS_INVALID_PARAMETER;
  295. @@ -945,14 +1007,14 @@ NTSTATUS nfs41_CreateVNetRoot(
  296.      DbgP("Config->{ "
  297.          "MntPt='%wZ', "
  298.          "SrvName='%wZ', "
  299. -        "use_nfspubfh=%d, "
  300. -        "ReadOnly=%d, "
  301. -        "write_thru=%d, "
  302. +        "usenfspubfh=%d, "
  303. +        "ro=%d, "
  304. +        "writethru=%d, "
  305.          "nocache=%d "
  306.          "timebasedcoherency=%d "
  307.          "timeout=%d "
  308. -        "createmode.use_nfsv3attrsea_mode=%d "
  309. -        "Config->createmode.mode=0%o "
  310. +        "dir_cmode=(usenfsv3attrs=%d mode=0%o) "
  311. +        "file_cmode=(usenfsv3attrs=%d mode=0%o) "
  312.          "}\n",
  313.          &Config->MntPt,
  314.          &Config->SrvName,
  315. @@ -962,15 +1024,21 @@ NTSTATUS nfs41_CreateVNetRoot(
  316.          Config->nocache?1:0,
  317.          Config->timebasedcoherency?1:0,
  318.          Config->timeout,
  319. -        Config->createmode.use_nfsv3attrsea_mode?1:0,
  320. -        Config->createmode.mode);
  321. +        Config->dir_createmode.use_nfsv3attrsea_mode?1:0,
  322. +        Config->dir_createmode.mode,
  323. +        Config->file_createmode.use_nfsv3attrsea_mode?1:0,
  324. +        Config->file_createmode.mode);
  325.  
  326.      pVNetRootContext->MountPathLen = Config->MntPt.Length;
  327.      pVNetRootContext->timeout = Config->timeout;
  328. -    pVNetRootContext->createmode.use_nfsv3attrsea_mode =
  329. -        Config->createmode.use_nfsv3attrsea_mode;
  330. -    pVNetRootContext->createmode.mode =
  331. -        Config->createmode.mode;
  332. +    pVNetRootContext->dir_createmode.use_nfsv3attrsea_mode =
  333. +        Config->dir_createmode.use_nfsv3attrsea_mode;
  334. +    pVNetRootContext->dir_createmode.mode =
  335. +        Config->dir_createmode.mode;
  336. +    pVNetRootContext->file_createmode.use_nfsv3attrsea_mode =
  337. +        Config->file_createmode.use_nfsv3attrsea_mode;
  338. +    pVNetRootContext->file_createmode.mode =
  339. +        Config->file_createmode.mode;
  340.  
  341.      status = map_sec_flavor(&Config->SecFlavor, &pVNetRootContext->sec_flavor);
  342.      if (status != STATUS_SUCCESS) {
  343. diff --git a/sys/nfs41sys_openclose.c b/sys/nfs41sys_openclose.c
  344. index 0018105..0a182af 100644
  345. --- a/sys/nfs41sys_openclose.c
  346. +++ b/sys/nfs41sys_openclose.c
  347. @@ -58,6 +58,7 @@
  348.  #include <winerror.h>
  349.  
  350.  #include <Ntstrsafe.h>
  351. +#include <stdbool.h>
  352.  
  353.  #include "nfs41sys_buildconfig.h"
  354.  
  355. @@ -604,11 +605,26 @@ NTSTATUS nfs41_Create(
  356.          entry->u.Open.open_owner_id = InterlockedIncrement(&open_owner_id);
  357.      // if we are creating a file check if nfsv3attributes were passed in
  358.      if (params->Disposition != FILE_OPEN && params->Disposition != FILE_OVERWRITE) {
  359. +        bool is_dir;
  360. +        bool use_nfsv3attrsea_mode;
  361. +
  362. +        is_dir = (params->CreateOptions & FILE_DIRECTORY_FILE)?true:false;
  363. +
  364.          /* Get default mode */
  365. -        entry->u.Open.mode = pVNetRootContext->createmode.mode;
  366. +        if (is_dir) {
  367. +            entry->u.Open.mode = pVNetRootContext->dir_createmode.mode;
  368. +        }
  369. +        else {
  370. +            entry->u.Open.mode = pVNetRootContext->file_createmode.mode;
  371. +        }
  372. +
  373. +        /* Prefer mode from NfsV3Attributes ? */
  374. +        use_nfsv3attrsea_mode = (is_dir?
  375. +            pVNetRootContext->dir_createmode.use_nfsv3attrsea_mode:
  376. +            pVNetRootContext->file_createmode.use_nfsv3attrsea_mode);
  377.  
  378.          /* Use mode from NfsV3Attributes */
  379. -        if (pVNetRootContext->createmode.use_nfsv3attrsea_mode &&
  380. +        if (use_nfsv3attrsea_mode &&
  381.              ea && AnsiStrEq(&NfsV3Attributes,
  382.              ea->EaName, ea->EaNameLength)) {
  383.              nfs3_attrs *attrs =
  384. @@ -616,13 +632,15 @@ NTSTATUS nfs41_Create(
  385.  
  386.              entry->u.Open.mode = attrs->mode;
  387.  #ifdef DEBUG_OPEN
  388. -            DbgP("creating file with EA mode 0%o\n",
  389. +            DbgP("creating '%s' with EA mode 0%o\n",
  390. +                (is_dir?"dir":"file"),
  391.                  entry->u.Open.mode);
  392.  #endif
  393.          }
  394.          else {
  395.  #ifdef DEBUG_OPEN
  396. -            DbgP("creating file with default mode 0%o\n",
  397. +            DbgP("creating '%s' with default mode 0%o\n",
  398. +                (is_dir?"dir":"file"),
  399.                  entry->u.Open.mode);
  400.  #endif
  401.          }
  402. --
  403. 2.45.1
  404.  
  405. From bc7972fb0d8bb6153efc6b422c7048bfbbcc3fba Mon Sep 17 00:00:00 2001
  406. From: Roland Mainz <roland.mainz@nrubsig.org>
  407. Date: Wed, 6 Nov 2024 15:22:12 +0100
  408. Subject: [PATCH 2/3] daemon: |stateid4_cmp()| should compare each |stateid4|
  409.  member seperately
  410.  
  411. |stateid4_cmp()| should compare each |stateid4| member seperately
  412. to avoid issues with hidding padding bytes etc.
  413.  
  414. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  415. ---
  416. daemon/util.h | 7 ++++++-
  417.  1 file changed, 6 insertions(+), 1 deletion(-)
  418.  
  419. diff --git a/daemon/util.h b/daemon/util.h
  420. index 2b83bbf..7c90864 100644
  421. --- a/daemon/util.h
  422. +++ b/daemon/util.h
  423. @@ -162,7 +162,12 @@ static __inline int stateid4_cmp(
  424.      IN  const stateid4 *restrict s1,
  425.      IN  const stateid4 *restrict s2)
  426.  {
  427. -    return memcmp(s1, s2, sizeof(stateid4));
  428. +    if (s1->seqid > s2->seqid)
  429. +        return 1;
  430. +    else if (s1->seqid < s2->seqid)
  431. +        return -1;
  432. +    else
  433. +        return memcmp(s1->other, s2->other, NFS4_STATEID_OTHER);
  434.  }
  435.  
  436.  static __inline void open_delegation4_cpy(
  437. --
  438. 2.45.1
  439.  
  440. From 06165d72695d82ab254f941b834825519758c547 Mon Sep 17 00:00:00 2001
  441. From: Roland Mainz <roland.mainz@nrubsig.org>
  442. Date: Wed, 6 Nov 2024 15:39:08 +0100
  443. Subject: [PATCH 3/3] tests: Add nfs_server_setup.txt as notes how to setup
  444.  servers for testing
  445.  
  446. Add nfs_server_setup.txt as notes how to setup servers for testing
  447.  
  448. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  449. ---
  450. tests/nfs_server_setup.txt | 43 ++++++++++++++++++++++++++++++++++++++
  451.  1 file changed, 43 insertions(+)
  452.  create mode 100644 tests/nfs_server_setup.txt
  453.  
  454. diff --git a/tests/nfs_server_setup.txt b/tests/nfs_server_setup.txt
  455. new file mode 100644
  456. index 0000000..68836e8
  457. --- /dev/null
  458. +++ b/tests/nfs_server_setup.txt
  459. @@ -0,0 +1,43 @@
  460. +#
  461. +# NFSv4.1 server setup for testing
  462. +#
  463. +
  464. +#
  465. +# TODO:
  466. +# - Debian Linux NFSv4.1 server setup
  467. +# - Solaris 11.4 NFSv4.1 server setup
  468. +# - Illumos 11.4 NFSv4.1 server setup
  469. +# - FreeBSD NFSv4.1 server setup
  470. +#
  471. +
  472. +#
  473. +# Windows Server 2019 NFSv4.1 server setup
  474. +#
  475. +
  476. +# Install Windows Server 2019, then run these commands in an
  477. +# Adminstrator PowerShell
  478. +Install-WindowsFeature -name Telnet-Client
  479. +
  480. +Import-Module ServerManager
  481. +Add-WindowsFeature FS-NFS-Service
  482. +Import-Module NFS
  483. +
  484. +mkdir C:\shares\nfsfolder
  485. +echo "hello world" >C:\shares\nfsfolder\testfile
  486. +icacls.exe C:\shares\nfsfolder /grant "Everyone:(F)"
  487. +
  488. +New-NfsShare -Name nfs1 -Path C:\shares\nfsfolder
  489. +Set-NfsShare -Name nfs1 -Permission readwrite -Authentication "sys" -EnableUnmappedAccess $True -AllowRootAccess $True
  490. +Set-NfsServerConfiguration -HideFilesBeginningInDot $True
  491. +
  492. +Grant-NfsSharePermission -Name nfs1 -ClientName "192.168.209.129" -ClientType "host" -AllowRootAccess $True -Permission readwrite
  493. +Grant-NfsSharePermission -Name nfs1 -ClientName "127.0.0.1" -ClientType "host" -AllowRootAccess $True -Permission readwrite
  494. +
  495. +nfsadmin server stop
  496. +nfsadmin server start
  497. +
  498. +Start-Service -Name ms-nfs41-client-service
  499. +
  500. +C:\cygwin64\sbin\nfs_mount -o rw N nfs://192.168.209.129//
  501. +
  502. +# EOF.
  503. --
  504. 2.45.1

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at