Skip to content

Instantly share code, notes, and snippets.

@shihanng
Last active May 3, 2018 01:15
Show Gist options
  • Save shihanng/a7030e54efce2f30ec4acf8a53baf663 to your computer and use it in GitHub Desktop.
Save shihanng/a7030e54efce2f30ec4acf8a53baf663 to your computer and use it in GitHub Desktop.
Auto-mount CIFS on Solus (or any other Linux OS)

Append something like below into /etc/fstab

# /etc/fstab: static file system information.
#
# <fs>      <mountpoint> <type> <opts>      <dump/pass>
...
//192.168.0.10/path/to/source /path/to/target cifs user,uid=1000,_netdev,noauto,x-systemd.automount,credentials=/path/to/cred 0 0
  • The value for uid can be obtained via
id -u <user-name>
  • _netdev,noauto,x-systemd.automount are necessary for network mount. See fstab at ArchWiki.

If you want them to be mounted only upon access, you will need to use the noauto,x-systemd.automount parameters.

Also, the _netdev option ensures systemd understands that the mount is network dependent and order it after the network is online.

  • Content of the /path/to/cred
username=<user>
password=<password>
  • Run the following to remount all the partitions
# mount -a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment