每次 Azure 应用服务重新启动时都会删除 OpenSSH 私钥

OpenSSH private key deleted every time Azure App Service restarts

我的应用程序服务需要通过 openSSH 进行无密码通信。我有一个托管在 Azure 上的 Linux 应用服务计划 B1 层。如果我键入“ssh-keygen”,它会在根目录中创建一个 .ssh 文件夹,并在该文件夹中创建 id_rsa 和 id_rsa.pub 没有问题。所以我将 .pub 密钥复制到远程服务器,无密码 ssh 连接工作得很好。但是在我停止并重新启动 App 服务后,这个 .ssh 文件夹消失了,我需要再次重复这个过程。有什么解决方法吗?谢谢。

Web App for Container 重启后会丢失数据。你可以看看 persistent storage, this will persist the data where you need when you restart the web app. And mount Azure Storage 也是一个选择。您可以select两种方式中的一种。