Give sshfs identity files unique filenames across mounts

If the same host was mounted as volume and backup or as a temporary
backup import, sharing the filename of the identify file would mean it
will get removed while still in use
This commit is contained in:
Johannes Zellner
2025-11-06 16:25:04 +01:00
parent 1bf2fe16a2
commit 21191bdc50
2 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -208,7 +208,7 @@ async function copyInternal(config, fromPath, toPath, options, progressCallback)
cpOptions += config.noHardlinks ? '' : 'l'; // this will hardlink backups saving space
if (config._provider === mounts.MOUNT_TYPE_SSHFS) {
const identityFilePath = path.join(paths.SSHFS_KEYS_DIR, `id_rsa_${config.mountOptions.host}`);
const identityFilePath = path.join(paths.SSHFS_KEYS_DIR, `identity_file_${path.basename(config._managedMountPath)}`);
const sshOptions = [ '-o', '"StrictHostKeyChecking no"', '-i', identityFilePath, '-p', config.mountOptions.port, `${config.mountOptions.user}@${config.mountOptions.host}` ];
const sshArgs = sshOptions.concat([ 'cp', cpOptions, path.join(config.prefix, fromPath), path.join(config.prefix, toPath) ]);
@@ -264,7 +264,7 @@ async function removeDir(config, remotePathPrefix, progressCallback) {
progressCallback({ message: `Removing directory ${fullPathPrefix}` });
if (config._provider === mounts.MOUNT_TYPE_SSHFS) {
const identityFilePath = path.join(paths.SSHFS_KEYS_DIR, `id_rsa_${config.mountOptions.host}`);
const identityFilePath = path.join(paths.SSHFS_KEYS_DIR, `identity_file_${path.basename(config._managedMountPath)}`);
const sshOptions = [ '-o', '"StrictHostKeyChecking no"', '-i', identityFilePath, '-p', config.mountOptions.port, `${config.mountOptions.user}@${config.mountOptions.host}` ];
const sshArgs = sshOptions.concat([ 'rm', '-rf', path.join(config.prefix, remotePathPrefix) ]);