You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> All mounting scripts in this article will mount SMB file shares using the default 0755 Linux file and folder permissions. This means read, write, and execute for the file/directory owner, read and execute for users in the owner group, and read and execute for other users. Depending on your organization's security policies, you might want to set alternate `uid`/`gid` or `dir_mode` and `file_mode` permissions in the mount options. For more information on how to set permissions, see [UNIX numeric notation](https://en.wikipedia.org/wiki/File_system_permissions#Numeric_notation).
33
+
> All mounting scripts in this article will mount SMB file shares using the default 0755 Linux file and folder permissions. This means read, write, and execute for the file/directory owner, read and execute for users in the owner group, and read and execute for other users. Depending on your organization's security policies, you might want to set alternate `uid`/`gid` or `dir_mode` and `file_mode` permissions in the mount options. For more information on how to set permissions, see [UNIX numeric notation](https://en.wikipedia.org/wiki/File_system_permissions#Numeric_notation). See [mount options](#mount-options) for a list of mount options.
34
34
35
35
## Applies to
36
36
@@ -45,7 +45,7 @@ uname -r
45
45
<aid="smb-client-reqs"></a>
46
46
47
47
* <aid="install-cifs-utils"></a>**Ensure the cifs-utils package is installed.**
48
-
Install the cifs-utils package using the package manager on the Linux distribution of your choice.
48
+
Install the latest version of the cifs-utils package using the package manager on the Linux distribution of your choice.
49
49
50
50
51
51
# [Ubuntu](#tab/Ubuntu)
@@ -155,7 +155,7 @@ fi
155
155
sudo chmod 600 $SMB_CREDENTIAL_FILE
156
156
```
157
157
158
-
Now you can mount the file share using the `mount`command using the credential file. In the following example, the `$SMB_PATH`command is populated using the fully qualified domain name for the storage account's file endpoint.
158
+
Now you can mount the file share with the `mount`command using the credential file. In the following example, the `$SMB_PATH`command is populated using the fully qualified domain name for the storage account's file endpoint. See [mount options](#mount-options) for a list of SMB mount options.
You can also mount the same Azure file share to multiple mount points if desired. When you're done using the Azure file share, use `sudo umount $mntPath` to unmount the share.
216
+
You can also mount the same Azure file share to multiple mount points if desired.
217
+
218
+
When you're done using the Azure file share, use `sudo umount $mntPath` to unmount the share.
Finally, create a record in the `/etc/fstab` file foryour Azure file share. In the command below, the default 0755 Linux file and folder permissions are used, which means read, write, and execute for the owner (based on the file/directory Linux owner), read and execute for usersin owner group, and read and execute for others on the system. You might wish to set alternate `uid` and `gid` or `dir_mode` and `file_mode` permissions on mount as desired. For more information on how to set permissions, see [UNIX numeric notation](https://en.wikipedia.org/wiki/File_system_permissions#Numeric_notation).
276
+
Finally, create a record in the `/etc/fstab` file foryour Azure file share. In the command below, the default 0755 Linux file and folder permissions are used, which means read, write, and execute for the owner (based on the file/directory Linux owner), read and execute for usersin owner group, and read and execute for others on the system. You might wish to set alternate `uid` and `gid` or `dir_mode` and `file_mode` permissions on mount as desired. For more information on how to set permissions, see [UNIX numeric notation](https://en.wikipedia.org/wiki/File_system_permissions#Numeric_notation). See [mount options](#mount-options) for a list of SMB mount options.
275
277
276
278
> [!TIP]
277
279
> If you want Docker containers running .NET Core applications to be able to write to the Azure file share, include **nobrl**in the SMB mount options to avoid sending byte range lock requests to the server.
@@ -330,7 +332,7 @@ sudo zypper install autofs
330
332
```
331
333
---
332
334
333
-
Next, update the `autofs` configuration files.
335
+
Next, update the `autofs` configuration files. See [mount options](#mount-options) for a list of SMB mount options.
334
336
335
337
```bash
336
338
FILE_SHARE_NAME="<file-share-name>"
@@ -352,11 +354,37 @@ The final step is to restart the `autofs` service.
352
354
sudo systemctl restart autofs
353
355
```
354
356
357
+
### Mount options
358
+
359
+
You can use the following mount options when mounting SMB Azure file shares on Linux.
|`password2=`| Storage account secondary key | Recommended incase when no-downtime key-rotation is desirable. |
366
+
|`mfsymlinks`| n/a | Recommended. Forces the mount to support symbolic links, allowing applications like git to clone repos with symlinks. |
367
+
|`actimeo=`| 30-60 | Recommended. Specifying `actimeo` sets all of `acregmin`, `acregmax`, `acdirmin`, and `acdirmax` to the same value. Using a value lower than 30 seconds can cause performance degradation because attribute caches for files and directories expire too quickly. We recommend setting `actimeo` between 30 and 60 seconds. |
368
+
|`nosharesock`| n/a | Optional. Forces the client to always make a new connection to the server even if it has an existing connection to the SMB mount. This can enhance performance, as each mount point will use a different TCP socket. In some cases, `nosharesock` can degrade performance due to not caching the same file when opened from two mounts from the same client. |
369
+
|`max_channels=`| 4 | Recommended when using SMB Multichannel. Specifies the maximum number of channels (network connections) to the file share. If you're using SMB Multichannel and the number of channels exceeds four, this will result in poor performance. |
370
+
| `remount` | n/a | Remounts the file share and changes mount options if specified. Use with the `password2` option in cases where you want to specify an alternative password to fix an expired password after the original mount. |
371
+
| `nobrl` | n/a | Recommended in single-client scenarios when advisory locks are required. Azure Files doesn't support advisory locks, and this setting prevents sending byte range lock requests to the server. |
372
+
|`snapshot=`|time| Mount a specific snapshot of the file share. Time must be a positive integer identifying the snapshot requested (in 100-nanosecond units that have elapsed since January 1, 1601, or alternatively it can be specified in GMT format e.g. @GMT-2024.03.27-20.52.19). |
373
+
|`closetimeo=`| 5 | Configures deferred close timeout (handle cache) in seconds, or disables it by setting to 0. Default is 5 seconds. |
374
+
|`nostrictsync`| n/a | Don't ask the server to flush on fsync(). Some servers perform non-buffered writes by default, in which case flushing is redundant. This option can improve performance for workloads where a client is performing a lot of small write + fsync combinations and where network latency is much higher than the server latency. |
375
+
| `multiuser` | n/a | Map user accesses to individual credentials when accessing the server. By default, CIFS mounts only use a single set of user credentials (the mount credentials) when accessing a share. With this option, the client instead creates a new session with the server using the user's credentials whenever a new user accesses the mount. Further accesses by that user will also use those credentials. Because the kernel can't prompt for passwords, multiuser mounts are limited to mounts using `sec=` options that don't require passwords. |
376
+
|`cifsacl`| n/a | This option is used to map CIFS/NTFS ACLs to/from Linux permission bits, map SIDs to/from UIDs and GIDs, and get and set Security Descriptors. Only supported for NTLMv2 authentication. |
377
+
|`idsfromsid,modefromsid`| n/a | Recommended when client needs to do client-enforced authorization. Enables Unix-style permissions. Only works when UIDs/GIDs are uniform across all the clients. Only supported for NTLMv2 authentication. |
378
+
|`sec=`| krb5 | Required for Kerberos authentication. To enable Kerberos security mode, set`sec=krb5`. You must omit username and password when using this option. The Linux client must be domain-joined. See [Enable Active Directory authentication over SMB for Linux clients](storage-files-identity-auth-linux-kerberos-enable.md). |
379
+
|`uid=`| 0 | Optional. Sets the uid that will own all files or directories on the mounted filesystem when the server doesn't provide ownership information. It can be specified as either a username or a numeric uid. When not specified, the default is 0. |
380
+
| `gid=` | 0 | Optional. Sets the gid that will own all files or directories on the mounted filesystem when the server doesn't provide ownership information. It can be specified as either a groupname or a numeric gid. When not specified, the default is 0. |
381
+
|`file_mode=`| n/a | Optional. If the server doesn't support the CIFS Unix extensions, this overrides the default file mode. |
382
+
| `dir_mode=` | n/a | Optional. If the server doesn't support the CIFS Unix extensions, this overrides the default mode for directories. |
383
+
|`handletimeout=`| n/a | Optional. The time (in milliseconds) for which the server should reserve the file handle after a failover waiting for the client to reconnect. |
384
+
355
385
## Next steps
356
386
357
-
See these links formore information about Azure Files:
387
+
For more information about using SMB Azure file shares with Linux, see:
358
388
359
-
- [Planning for an Azure Files deployment](storage-files-planning.md)
360
389
- [Remove SMB 1 on Linux](files-remove-smb1-linux.md)
361
390
- [Troubleshoot general SMB issues on Linux](/troubleshoot/azure/azure-storage/files-troubleshoot-linux-smb?toc=/azure/storage/files/toc.json)
362
-
- [Troubleshoot general NFS issues on Linux](/troubleshoot/azure/azure-storage/files-troubleshoot-linux-nfs?toc=/azure/storage/files/toc.json)
0 commit comments