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:
@@ -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) ]);
|
||||
|
||||
Reference in New Issue
Block a user