Skip to content

Commit 6f6fde1

Browse files
committed
Add autofs config Azure file shares Linux
1 parent e236a86 commit 6f6fde1

File tree

1 file changed

+48
-1
lines changed

1 file changed

+48
-1
lines changed

articles/storage/files/storage-how-to-use-files-linux.md

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,57 @@ When you are done using the Azure file share, you may use `sudo umount $mntPath`
189189
> [!Note]
190190
> The above mount command mounts with SMB 3.0. If your Linux distribution does not support SMB 3.0 with encryption or if it only supports SMB 2.1, you may only mount from an Azure VM within the same region as the storage account. To mount your Azure file share on a Linux distribution that does not support SMB 3.0 with encryption, you will need to [disable encryption in transit for the storage account](../common/storage-require-secure-transfer.md?toc=%2fazure%2fstorage%2ffiles%2ftoc.json).
191191
192+
### Using autofs to automatically mount the Azure file share(s)
193+
194+
1. **Ensure the autofs package is installed.**
195+
196+
The autofs package can be installed using the package manager on the Linux distribution of your choice.
197+
198+
On **Ubuntu** and **Debian-based** distributions, use the `apt` package manager:
199+
```bash
200+
sudo apt update
201+
sudo apt install autofs
202+
```
203+
On **Fedora**, **Red Hat Enterprise Linux 8+**, and **CentOS 8 +**, use the `dnf` package manager:
204+
```bash
205+
sudo dnf install autofs
206+
```
207+
On older versions of **Red Hat Enterprise Linux** and **CentOS**, use the `yum` package manager:
208+
```bash
209+
sudo yum install autofs
210+
```
211+
On **openSUSE**, use the `zypper` package manager:
212+
```bash
213+
sudo zypper install autofs
214+
```
215+
2. **Create a mount point for the share(s)**:
216+
```bash
217+
sudo mkdir /fileshares
218+
```
219+
3. **Crete a new custom autofs configuration file**
220+
```bash
221+
sudo vi /etc/auto.fileshares
222+
```
223+
4. **Add the following entries to /etc/auto.fileshares**
224+
```bash
225+
echo "$fileShareName -fstype=cifs,credentials=$smbCredentialFile :$smbPath"" > /etc/auto.fileshares
226+
```
227+
5. **Add the following entry to /etc/auto.master**
228+
```bash
229+
/fileshares /etc/auto.fileshares --timeout=60
230+
```
231+
6. **Restart autofs**
232+
```bash
233+
sudo systemctl restart autofs
234+
```
235+
7. **Access the folder designated for the share**
236+
```bash
237+
cd /fileshares/$filesharename
238+
```
192239
## Securing Linux
193240
In order to mount an Azure file share on Linux, port 445 must be accessible. Many organizations block port 445 because of the security risks inherent with SMB 1. SMB 1, also known as CIFS (Common Internet File System), is a legacy file system protocol included with many Linux distributions. SMB 1 is an outdated, inefficient, and most importantly insecure protocol. The good news is that Azure Files does not support SMB 1, and starting with Linux kernel version 4.18, Linux makes it possible to disable SMB 1. We always [strongly recommend](https://aka.ms/stopusingsmb1) disabling the SMB 1 on your Linux clients before using SMB file shares in production.
194241
195-
Starting with Linux kernel 4.18, the SMB kernel module, called `cifs` for legacy reasons, exposes a new module parameter (often referred to as *parm* by various external documentation), called `disable_legacy_dialects`. Although introduced in Linux kernel 4.18, some vendors have backported this change to older kernels that they support. For convenience, the following table details the availability of this module parameter on common Linux distributions.
242+
Starting with Linux kernel 4.18, the SMB kernel module, called `cifs` for legacy reasons, exposes a new module parameter (often referred to as *parm* by various external documentations), called `disable_legacy_dialects`. Although introduced in Linux kernel 4.18, some vendors have backported this change to older kernels that they support. For convenience, the following table details the availability of this module parameter on common Linux distributions.
196243
197244
| Distribution | Can disable SMB 1 |
198245
|--------------|-------------------|

0 commit comments

Comments
 (0)