Difference between revisions of "How to mount a Network Share under Linux with a Credentials file and On-Demand Mounting"

From steamWiki
Jump to: navigation, search
(Created page with "This is a quick how to showing the steps to setup a network share under Linux using a protected credentials file to store the username and password as well as enabling "on-dem...")
(No difference)

Revision as of 07:25, 15 May 2019

This is a quick how to showing the steps to setup a network share under Linux using a protected credentials file to store the username and password as well as enabling "on-demand" mounting. This means that the shares won't be mounted at boot but instead will be mounted the first time the directory is accessed.

  1. Create your Credentials file
    1. run sudo mkdir /root/.credentials to create a place to store your credentials files
    2. run sudo chmod 700 /root/.credentials to make it so that only root can access this directory
    3. run sudo nano /root/.credentials/server-credentials and enter in the following into that file (replacing USER and PASSWORD with the appropriate values for your server)
      • username=USER
      • password=PASSWORD
    4. run chmod 600 /root/.credentials/server-credentials to make it so that only root can read this file
  2. Create your Local Share Directory
    1. run sudo mkdir /mnt/server/share
  3. Modify your fstab file
    1. run sudo nano /etc/fstab
    2. add the following line to the bottom of the file
      • //server/share /mnt/server/share cifs credentials=/root/.credentials/server-credentials
  4. Test your changes
    1. run sudo mount -a to reload the fstab file
    2. run cd /mnt/server/share to navigate to the network share directory
    3. run ls to see what's there. It should now be populated with whatever is on the network share