diff --git a/app/client/modules/repositories/components/create-repository-form.tsx b/app/client/modules/repositories/components/create-repository-form.tsx index 79760ca2..08fa6e0b 100644 --- a/app/client/modules/repositories/components/create-repository-form.tsx +++ b/app/client/modules/repositories/components/create-repository-form.tsx @@ -58,7 +58,7 @@ const defaultValuesForType = { azure: { backend: "azure" as const, compressionMode: "auto" as const }, rclone: { backend: "rclone" as const, compressionMode: "auto" as const }, rest: { backend: "rest" as const, compressionMode: "auto" as const }, - sftp: { backend: "sftp" as const, compressionMode: "auto" as const, port: 22, skipHostKeyCheck: true }, + sftp: { backend: "sftp" as const, compressionMode: "auto" as const, port: 22, skipHostKeyCheck: false }, }; export const CreateRepositoryForm = ({ diff --git a/app/client/modules/repositories/components/repository-forms/sftp-repository-form.tsx b/app/client/modules/repositories/components/repository-forms/sftp-repository-form.tsx index 8ed55217..c5286a60 100644 --- a/app/client/modules/repositories/components/repository-forms/sftp-repository-form.tsx +++ b/app/client/modules/repositories/components/repository-forms/sftp-repository-form.tsx @@ -100,7 +100,6 @@ export const SftpRepositoryForm = ({ form }: Props) => { (
diff --git a/app/client/modules/volumes/components/create-volume-form.tsx b/app/client/modules/volumes/components/create-volume-form.tsx index 764a3c6a..745f9eb3 100644 --- a/app/client/modules/volumes/components/create-volume-form.tsx +++ b/app/client/modules/volumes/components/create-volume-form.tsx @@ -46,7 +46,7 @@ const defaultValuesForType = { smb: { backend: "smb" as const, port: 445, vers: "3.0" as const }, webdav: { backend: "webdav" as const, port: 80, ssl: false, path: "/webdav" }, rclone: { backend: "rclone" as const, path: "/" }, - sftp: { backend: "sftp" as const, port: 22, path: "/", skipHostKeyCheck: true }, + sftp: { backend: "sftp" as const, port: 22, path: "/", skipHostKeyCheck: false }, }; export const CreateVolumeForm = ({ onSubmit, mode = "create", initialValues, formId, loading, className }: Props) => { diff --git a/app/client/modules/volumes/components/volume-forms/sftp-form.tsx b/app/client/modules/volumes/components/volume-forms/sftp-form.tsx index 1d9fa8d6..821dc5f5 100644 --- a/app/client/modules/volumes/components/volume-forms/sftp-form.tsx +++ b/app/client/modules/volumes/components/volume-forms/sftp-form.tsx @@ -118,7 +118,6 @@ export const SFTPForm = ({ form }: Props) => { (
diff --git a/app/server/modules/backends/sftp/sftp-backend.ts b/app/server/modules/backends/sftp/sftp-backend.ts index a5eb1de0..78d25a8d 100644 --- a/app/server/modules/backends/sftp/sftp-backend.ts +++ b/app/server/modules/backends/sftp/sftp-backend.ts @@ -60,7 +60,7 @@ const mount = async (config: BackendConfig, mountPath: string) => { "gid=1000", ]; - if (config.skipHostKeyCheck) { + if (config.skipHostKeyCheck || !config.knownHosts) { options.push("StrictHostKeyChecking=no", "UserKnownHostsFile=/dev/null"); } else if (config.knownHosts) { const knownHostsPath = getKnownHostsPath(mountPath); diff --git a/app/server/utils/restic.ts b/app/server/utils/restic.ts index a7773cf3..8f696f35 100644 --- a/app/server/utils/restic.ts +++ b/app/server/utils/restic.ts @@ -186,7 +186,7 @@ export const buildEnv = async (config: RepositoryConfig) => { keyPath, ]; - if (config.skipHostKeyCheck) { + if (config.skipHostKeyCheck || !config.knownHosts) { sshArgs.push("-o", "StrictHostKeyChecking=no", "-o", "UserKnownHostsFile=/dev/null"); } else if (config.knownHosts) { const knownHostsPath = path.join("/tmp", `zerobyte-known-hosts-${crypto.randomBytes(8).toString("hex")}`);