SSHFS: Difference between revisions

From NixOS Wiki
Klinger (talk | contribs)
m typo
Vera (talk | contribs)
m Fixed typo in code block
 
(4 intermediate revisions by 3 users not shown)
Line 2: Line 2:


== Configuration ==
== Configuration ==
Following example configuration will mount the remote filesystem <code>/mydata</code> of the host <code>10.0.1.100</code> at the destination <code>/mnt</code>. Authentication is done via the user <code>myuser</code> and the private key <code>/root/.ssh/id_rsa</code>.<syntaxhighlight lang="nix">
Following example configuration will mount the remote filesystem <code>/mydata</code> of the host <code>10.0.1.100</code> at the destination <code>/mnt</code>. Authentication is done via the user <code>myuser</code> and the private key <code>/root/.ssh/id_ed25519</code>.<syntaxhighlight lang="nix">
fileSystems."/mnt" = {
fileSystems."/mnt" = {
   device = "myuer@10.0.1.100:/mydata";
   device = "myuser@10.0.1.100:/mydata";
   fsType = "sshfs";
   fsType = "sshfs";
   options = [
   options = [
Line 10: Line 10:
     "noatime"
     "noatime"
     "allow_other"
     "allow_other"
     "IdentityFile=/root/.ssh/id_rsa"
     "IdentityFile=/root/.ssh/id_ed25519"
   ];
   ];
};
};
</syntaxhighlight>
</syntaxhighlight>


== See also ==
* [[Rclone]], which also supports mounting via SFTP. Possibly a more robust and stable implementation.


[[Category:Filesystem]]
[[Category:Filesystem]]
[[Category:Networking]]

Latest revision as of 21:52, 13 October 2024

SSHFS is a file system that allows users to mount and access remote files over SSH (Secure Shell) connections, providing secure and encrypted access to remote data.

Configuration

Following example configuration will mount the remote filesystem /mydata of the host 10.0.1.100 at the destination /mnt. Authentication is done via the user myuser and the private key /root/.ssh/id_ed25519.

fileSystems."/mnt" = {
  device = "myuser@10.0.1.100:/mydata";
  fsType = "sshfs";
  options = [
    "nodev"
    "noatime"
    "allow_other"
    "IdentityFile=/root/.ssh/id_ed25519"
  ];
};

See also

  • Rclone, which also supports mounting via SFTP. Possibly a more robust and stable implementation.