To configure a system to automount a Samba share using /etc/fstab
, you will need to edit the /etc/fstab
file and add a line for the Samba share. The line should have the following format:
//server/share /mount/point cifs username=USERNAME,password=PASSWORD,vers=2.0 0 0
Replace server
with the hostname or IP address of the Samba server, share
with the name of the shared folder, mount/point
with the directory where you want to mount the share, USERNAME
with your Samba username, and PASSWORD
with your Samba password.
For example, to mount a Samba share called documents
from a server with the hostname samba-server
at /mnt/samba
, you might use the following line:
//samba-server/documents /mnt/samba cifs username=myuser,password=mypassword,vers=2.0 0 0
Note that the vers=2.0
option specifies the version of the SMB protocol to use. This may need to be adjusted depending on the version of the Samba server you are connecting to.
Once you have added the line to /etc/fstab
, you can mount the Samba share by running the mount -a
command, which will mount all file systems listed in /etc/fstab
. The share should now be automatically mounted at boot time as well.