It has nothing to do with autofs. FUSE was originally developed for Linux, but has since then been implemented on.BSDs, OpenSolaris, Minix and macOS. It looks like Microsoft has chosen not to implement FUSE in WSL. Probably because it would have to interface with the Windows kernel at a deeper level than WSL is designed to do. Jan 21, 2013 Automount is the modern way to mount directories over a network. It is far easier to manage and is more economic in bandwidth. In this howto, autofs will be configured through an LDAP directory: in that way, we have a centralised configuration and make maximum use of the LDAP that has been setup.
AutoFS provides automounting of removable media or network shares when they are inserted or accessed.
- 2Configuration
- 2.2NFS network mounts
- 2.3Samba
- 2.4FTP and SSH (with FUSE)
- 4Troubleshooting and tweaks
- Autofs is a service in Linux like operating system which automatically mounts the file system and remote shares when it is accessed. Main advantage of autofs is that you don't need to mount file system at all time, file system is only mounted when it is in demand.
- In Ubuntu there are two options either using autofs or the automount feature of systemd. Could perhaps someone tell me what the differences (apart from different configuration) between the two options are. Autofs seems to be more flexible as one can configure scripts for the automount locations. Is this possible using the systemd automount as well?
Install the autofs package.
autofs4
module.AutoFS uses template files for configuration which are located in /etc/autofs
The main template is called auto.master
, which can point to one or more other templates for specific media types.
- Open the file
/etc/autofs/auto.master
with your favorite editor, you will see something similar to this:
The first value on each line determines the base directory under which all the media in a template are mounted, the second value is which template to use. The default base path is /media
, but you can change this to any other location you prefer. For instance:
ENTER
after last word). If there is no correct EOF (end of file) line, the AutoFS daemon will not properly load.The optional parameter timeout
sets the amount of seconds after which to unmount directories.
The base directory will be created if it does not exist on your system. The base directory will be mounted on to load the dynamically loaded media, which means any content in the base directory will not be accessible while autofs is on. This procedure is however non-destructive, so if you accidentally automount into a live directory you can just change the location in auto.master
and restart AutoFS to regain the original contents.
If you still want to automount to a target non-empty directory and want to have the original files available even after the dynamically loaded directories are mounted, you can use autofs to mount them to another directory (e.g. /var/autofs/net) and create soft links.
Alternatively, you can have autofs mount your media to a specific folder, rather than inside a common folder.
- Open the file
/etc/nsswitch.conf
and add an entry for automount:
- When you are done configuring your templates (see below), launch the AutoFS daemon as root by enabling and starting the
autofs.service
.
Devices are now automatically mounted when they are accessed, they will remain mounted as long as you access them.
Removable mediaRemovable devices are assigned block device locations according to the next available spot, e.g. if /dev/sd{a,b,c}
are already occupied, the next removable media will be given block /dev/sdd
. Instead of assigning a mount point based on an unreliable block device path, a more robust approach is to use the UUID or PARTUUID of the removable media as the location in the map file.
Iwatermark pro 2 5 10. For example, to mount a specific USB drive to the path /mnt/black
, configure the template file and map file:
Use blkid
to find the UUID of the partition to mount, then generate the map file:
Resume templates 2020. This article or section needs language, wiki syntax or style improvements. See Help:Style for reference.
AutoFS provides a new way of automatically discovering and mounting NFS-shares on remote servers (the AutoFS network template in /etc/autofs/auto.net
has been removed in autofs5). To enable automatic discovery and mounting of network shares from all accessible servers without any further configuration, you will need to add the following to the /etc/autofs/auto.master
file:
/etc/hosts
or via DNS and make sure you have nfs-utils installed and configured. You also have to enablerpcbind
to browse shared Folders.For instance, if you have a remote server fileserver (the name of the directory is the hostname of the server) with an NFS share named /home/share, you can just access the share by typing:
/etc/conf.d/autofs
in order to start the AutoFS daemon.The -hosts
option uses a similar mechanism as the showmount
command to detect remote shares. You can see the exported shares by typing:
Replacing with the name of your own server.
Manual NFS configurationTo mount a NFS share on server_name called /srv/shared_dir to another computer named client_pc at location /mnt/foo, edit auto.master and create a configuration file for the share (auto.server_name):
Samba Single sharesAdd the following to /etc/autofs/auto.master
:
where --timeout
defines how many seconds to wait before the file system is unmounted. The --browse
option creates empty folders for each mount-point in the file in order to prevent timeouts, if a network share cannot be contacted.
Next create a file /etc/autofs/auto.[my_server]
You can specify a user name and password to use with the share in the other_options
section:
You may be specify multiple shares in the /etc/autofs/auto.[my_server]
, for instance:
See the comments in /etc/autofs/auto.smb
.
Remote FTP and SSH servers can be accessed seamlessly with AutoFS using FUSE, a virtual file system layer.
Remote FTPFirst, install the curlftpfs package.Load the fuse module:
Create a /etc/modules-load.d/fuse.conf
file containg fuse
to load it on each system boot.
Next, add a new entry for FTP servers in /etc/autofs/auto.master
:
Create the file /etc/autofs/auto.ftp
and add a server using the ftp://myuser:mypassword@host:port/path
format:
df
(only for mounted servers) or view the file /etc/autofs/auto.ftp
.If you want slightly more security you can create the file ~root/.netrc
and add the passwords there. Passwords are still plain text, but you can have mode 600, and df
command will not show them (mounted or not).This method is also less sensitive to special characters (that else must be escaped) in the passwords. The format is:
The line in /etc/autofs/auto.ftp
looks like this without user and password: Internet speed test 3 0 speed.
Create the file /sbin/mount.curl
with this code:
Create the file /sbin/umount.curl
with this code:
Set the permissions for both files:
After a restart your new FTP server should be accessible through /media/ftp/servername
.
The factual accuracy of this article or section is disputed.
These are basic instructions to access a remote filesystem over SSH with AutoFS.
Install the sshfs package.
Load the fuse
module:
Create a /etc/modules-load.d/fuse.conf
file containg fuse
to load it on each system boot if you have not one yet.
Install openssh.
Generate an SSH keypair:
When the generator ask for a passphrase, just press ENTER
. Using SSH keys without a passphrase is less secure, yet running AutoFS together with passphrases poses some additional difficulties which are not (yet) covered in this article.
Next, copy the public key to the remote SSH server:
As root, see that you can login to the remote server:
known_hosts
. Hosts can be also be manually added to /etc/ssh/ssh_known_hosts
.Create a new entry for SSH servers in /etc/autofs/auto.master
:
Create the file /etc/autofs/auto.ssh
and add an SSH server:
After a restart your SSH server should be accessible through /media/ssh/servername
.
AutoFS uses template files for configuration which are located in /etc/autofs
The main template is called auto.master
, which can point to one or more other templates for specific media types.
- Open the file
/etc/autofs/auto.master
with your favorite editor, you will see something similar to this:
The first value on each line determines the base directory under which all the media in a template are mounted, the second value is which template to use. The default base path is /media
, but you can change this to any other location you prefer. For instance:
ENTER
after last word). If there is no correct EOF (end of file) line, the AutoFS daemon will not properly load.The optional parameter timeout
sets the amount of seconds after which to unmount directories.
The base directory will be created if it does not exist on your system. The base directory will be mounted on to load the dynamically loaded media, which means any content in the base directory will not be accessible while autofs is on. This procedure is however non-destructive, so if you accidentally automount into a live directory you can just change the location in auto.master
and restart AutoFS to regain the original contents.
If you still want to automount to a target non-empty directory and want to have the original files available even after the dynamically loaded directories are mounted, you can use autofs to mount them to another directory (e.g. /var/autofs/net) and create soft links.
Alternatively, you can have autofs mount your media to a specific folder, rather than inside a common folder.
- Open the file
/etc/nsswitch.conf
and add an entry for automount:
- When you are done configuring your templates (see below), launch the AutoFS daemon as root by enabling and starting the
autofs.service
.
Devices are now automatically mounted when they are accessed, they will remain mounted as long as you access them.
Removable mediaRemovable devices are assigned block device locations according to the next available spot, e.g. if /dev/sd{a,b,c}
are already occupied, the next removable media will be given block /dev/sdd
. Instead of assigning a mount point based on an unreliable block device path, a more robust approach is to use the UUID or PARTUUID of the removable media as the location in the map file.
Iwatermark pro 2 5 10. For example, to mount a specific USB drive to the path /mnt/black
, configure the template file and map file:
Use blkid
to find the UUID of the partition to mount, then generate the map file:
Resume templates 2020. This article or section needs language, wiki syntax or style improvements. See Help:Style for reference.
AutoFS provides a new way of automatically discovering and mounting NFS-shares on remote servers (the AutoFS network template in /etc/autofs/auto.net
has been removed in autofs5). To enable automatic discovery and mounting of network shares from all accessible servers without any further configuration, you will need to add the following to the /etc/autofs/auto.master
file:
/etc/hosts
or via DNS and make sure you have nfs-utils installed and configured. You also have to enablerpcbind
to browse shared Folders.For instance, if you have a remote server fileserver (the name of the directory is the hostname of the server) with an NFS share named /home/share, you can just access the share by typing:
/etc/conf.d/autofs
in order to start the AutoFS daemon.The -hosts
option uses a similar mechanism as the showmount
command to detect remote shares. You can see the exported shares by typing:
Replacing with the name of your own server.
Manual NFS configurationTo mount a NFS share on server_name called /srv/shared_dir to another computer named client_pc at location /mnt/foo, edit auto.master and create a configuration file for the share (auto.server_name):
Samba Single sharesAdd the following to /etc/autofs/auto.master
:
where --timeout
defines how many seconds to wait before the file system is unmounted. The --browse
option creates empty folders for each mount-point in the file in order to prevent timeouts, if a network share cannot be contacted.
Next create a file /etc/autofs/auto.[my_server]
You can specify a user name and password to use with the share in the other_options
section:
You may be specify multiple shares in the /etc/autofs/auto.[my_server]
, for instance:
See the comments in /etc/autofs/auto.smb
.
Remote FTP and SSH servers can be accessed seamlessly with AutoFS using FUSE, a virtual file system layer.
Remote FTPFirst, install the curlftpfs package.Load the fuse module:
Create a /etc/modules-load.d/fuse.conf
file containg fuse
to load it on each system boot.
Next, add a new entry for FTP servers in /etc/autofs/auto.master
:
Create the file /etc/autofs/auto.ftp
and add a server using the ftp://myuser:mypassword@host:port/path
format:
df
(only for mounted servers) or view the file /etc/autofs/auto.ftp
.If you want slightly more security you can create the file ~root/.netrc
and add the passwords there. Passwords are still plain text, but you can have mode 600, and df
command will not show them (mounted or not).This method is also less sensitive to special characters (that else must be escaped) in the passwords. The format is:
The line in /etc/autofs/auto.ftp
looks like this without user and password: Internet speed test 3 0 speed.
Create the file /sbin/mount.curl
with this code:
Create the file /sbin/umount.curl
with this code:
Set the permissions for both files:
After a restart your new FTP server should be accessible through /media/ftp/servername
.
The factual accuracy of this article or section is disputed.
These are basic instructions to access a remote filesystem over SSH with AutoFS.
Install the sshfs package.
Load the fuse
module:
Create a /etc/modules-load.d/fuse.conf
file containg fuse
to load it on each system boot if you have not one yet.
Install openssh.
Generate an SSH keypair:
When the generator ask for a passphrase, just press ENTER
. Using SSH keys without a passphrase is less secure, yet running AutoFS together with passphrases poses some additional difficulties which are not (yet) covered in this article.
Next, copy the public key to the remote SSH server:
As root, see that you can login to the remote server:
known_hosts
. Hosts can be also be manually added to /etc/ssh/ssh_known_hosts
.Create a new entry for SSH servers in /etc/autofs/auto.master
:
Create the file /etc/autofs/auto.ssh
and add an SSH server:
After a restart your SSH server should be accessible through /media/ssh/servername
.
Media Transfer Protocol (MTP) is used in some Android devices.
https://coolrfil261.weebly.com/find-vegas-slots.html. Install the mtpfs package.
Create a new entry for MTP Device in /etc/autofs/auto.misc
:
This section contains a few solutions for common issues with AutoFS.
Using NISVersion 5.0.5 of AutoFS has more advanced support for NIS. Fasttasks 2 46 – the troubleshooting apple. To use AutoFS together with NIS, add yp:
in front of the template names in /etc/autofs/auto.master
:
On earlier versions of NIS (before 5.0.4), you should add nis
to /etc/nsswitch.conf
:
You can set parameters like timeout
systemwide for all AutoFS media in /etc/default/autofs
:
- Open the
/etc/default/autofs
file and edit theOPTIONS
line:
- To enable logging (default is no logging at all), uncomment and add
--verbose
to theOPTIONS
line in/etc/default/autofs
e.g.:
After restarting the autofs
daemon, verbose output is visible in systemctl status
or in journalctl
.
If you use multiple USB drives/sticks and want to easily tell them apart, you can use AutoFS to set up the mount points and Udev to create distinct names for your USB drives. See udev#Setting static device names for instructions on setting up Udev rules.
AutoFS permissionsIf AutoFS is not working for you, make sure that the permissions of the templates files are correct, otherwise AutoFS will not start. This may happen if you backed up your configuration files in a manner which did not preserve file modes. Here are what the modes should be on the configuration files:
- 0644 - /etc/autofs/auto.master
- 0644 - /etc/autofs/auto.media
- 0644 - /etc/autofs/auto.misc
- 0644 - /etc/conf.d/autofs
In general, scripts (like previous auto.net
) should have executable (chmod a+x filename
) bits set and lists of mounts should not.
If you are getting errors in /var/log/daemon.log
similar to this, you have a permissions problem:
With certain versions of util-linux, you may not be able to unmount a fuse file system drive mounted by autofs, even if you use the 'user=' option. See the discussion here:http://fuse.996288.n3.nabble.com/Cannot-umount-as-non-root-user-anymore-tp689p697.html
Debugging auto mount issuesFor better debugging you might try running automount in foreground.
Of if you want more debug info than try:
Alternatives to AutoFS- Systemd can automount filesystems upon demand; see here for the description and the article on sshfs for an example.
- Thunar Volume Manager is an automount system for users of the Thunar file manager.
- PCManFM is a lightweight file manager with built-in support for accessing remote shares
- Udisks is a minimalistic automatic disk mounting service
- FTP and SFTP usage with AutoFS is based on this Gentoo Wiki article: https://web.archive.org/web/20130414074212/http://en.gentoo-wiki.com/wiki/Mounting_SFTP_and_FTP_shares
- More information on SSH can be found on the SSH and Using SSH Keys pages of this wiki.
- Ubuntu's Autofs help wiki is at https://help.ubuntu.com/community/Autofs
- For filesystem specific mount options check http://manpages.ubuntu.com/manpages/focal/man8/mount.8.html#filesystem-specific%20mount%20options
- For fuse specific mount options check http://manpages.ubuntu.com/manpages/precise/man8/mount.fuse.8.html