Secure your credentials for file share mounts on Ubuntu 17.04

I was in “Just make it work” mode and found I’d left my credentials out in plain text after setting up my Plex server to read off a remote fileshare.

Don’t do that, instead, do this:

  1. Create a directory on your local linux machine where you’ll access the file share:
     sudo mkdir /media/PlexMedia
  2. Modify /etc/fstab and add the following:
     //remoteservername/fileshare /media/PlexMedia cifs uid=1000,iocharset=utf8,credentials=/etc/cifs-creds 0 0
  3. Now you need to create the credentials file:
     sudo touch cifs-creds && sudo chmod 600 cifs-creds
  4. Use your favorite editor to modify the newly-created ‘cifs-creds’ file and add the following:
  5. Reboot, and you’ll auto-mount the file share, securely 🙂

Leave a Reply