Difference between revisions of "How to mount a Network Share under Linux with a Credentials file and On-Demand Mounting"
From steamWiki
(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.
- Create your Credentials file
- run sudo mkdir /root/.credentials to create a place to store your credentials files
- run sudo chmod 700 /root/.credentials to make it so that only root can access this directory
- 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
- run chmod 600 /root/.credentials/server-credentials to make it so that only root can read this file
- Create your Local Share Directory
- run sudo mkdir /mnt/server/share
- Modify your fstab file
- run sudo nano /etc/fstab
- add the following line to the bottom of the file
- //server/share /mnt/server/share cifs credentials=/root/.credentials/server-credentials
- Test your changes
- run sudo mount -a to reload the fstab file
- run cd /mnt/server/share to navigate to the network share directory
- run ls to see what's there. It should now be populated with whatever is on the network share