Find the answer to your Linux question:
Results 1 to 4 of 4
Hello, anyone knows how to encrypt a samba credentials file that will still be usable while mounting? in /etc/fstab I have the following //share/folder /mnt cifs defaults,soft,credentials=/path/to/cred 0 0 in ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2013
    Posts
    5

    Samba credentials encryption


    Hello,

    anyone knows how to encrypt a samba credentials file that will still be usable while mounting?
    in /etc/fstab I have the following
    //share/folder /mnt cifs defaults,soft,credentials=/path/to/cred 0 0

    in the cred file I have:
    username=user
    password=password

    can it be encrypted / hidden in someway but still be readable for the root user?
    Thanks

  2. #2
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    hello and welcome, Expect!

    The text itself has to be in plain-text, so that the samba lib functions can read it, so you can't encrypt it. but you can make it hidden if you really want. just put a "." at the beginning of the filename, e.g.:

    Code:
    .cred
    then commands like "ls" won't show it, by default (but it will with the "-a" flag).

    and of course, you should put it in a dir owned by root that prevents world-read access, e.g.:

    Code:
    /root/.cred
    but anyone who's got root will find it.

    i assume you want it to be able to mount w/o user interaction, right? if not, then yeah, you could encrypt it (with any number of Linux libraries or 3rd party utils), then decrypt it right before you run the mount command, then encrypt it again, after the mount command.

  3. #3
    Just Joined!
    Join Date
    Jul 2013
    Posts
    5
    Thanks for the answer mate.

  4. $spacer_open
    $spacer_close
  5. #4
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    marking as Solved. Note that you can do this yourself at any time using the Thread Tools link at the top of the page.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •