0

I have a TrueNAS NAS smb share. My TrueNAS user settings have password disabled and I have added my SSH public key. I can SSH into the NAS using my private key with no issues. However, I am trying to figure out how to mount an SMB share to my linux machine.

/etc/fstab

//nasdomain/share /mnt/nas/share cifs username=nasusername,uid=linuxusername,gid=linuxusername 0 0

When I run sudo mount -a, I am promted to login to the share as nasusername. How do I login using my private key?

Is it possible to even login using key-pairs or does SMB only support user/pass? If impossible, what's the goto NAS fileshare that can use key-pairs?

1 Answer 1

1

You don't – the SSH keys are only useful for SSH, which SMB is not.

SMB only supports NTLM (password-based) and Kerberos (MS AD) authentication. For NTLM auth (which is the only option on most non-AD systems), the SMB server will likely have its own password database separate from the rest of the OS.

(Kerberos supports private-key authentication, but it's still completely different from SSH keys.)

Use the sshfs or fuse.sshfs filesystem type for SSH-based SFTP file access (you'll need to have the sshfs package installed on the client). The performance of SFTP might be slightly worse than that of SMBv3.

2
  • So I could use SMB CIFS (not SSHFS) using Kerberos auth? Nov 8, 2022 at 12:16
  • 1
    Yes, if you have the Kerberos infrastructure already (e.g. MS AD, FreeIPA, or a homegrown KDC) – but although basic Kerberos is easy, setting up public-key PKI for Kerberos (and then making Linux use it) is usually quite a bit more annoying than sshfs with SSH keys, so I wouldn't bother.
    – user1686
    Nov 8, 2022 at 12:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.