目前正在运行Google计算引擎实例并在服务器上使用SFTP .
以下详细信息使用此处列出的步骤将用户锁定到SFTP路径:https://bensmann.no/restrict-sftp-users-to-home-folder/
To lock the user to a directory, the home directory of that user needs to be owned by root. 最初,设置工作正常,但发现 Google compute engine sporadically "auto-resets" the permissions back to the user.
我使用的是Google Cloud 端控制台中设置的SSH密钥,该密钥与用户名相关联 . 我的猜测是Google Compute Engine正在使用这个“元数据”并重新配置文件夹权限以匹配与SSH密钥关联的用户的权限 .
Is there any way to disable this "auto-reset"? 或者,有没有更好的方法来托管SFTP并将单个用户锁定到SFTP路径而无需将主文件夹所有权更改为root?
1 回答
设置sshd规则以应用于google-sudoers组 .
管理用户帐户的工具是accounts daemon . 您可以暂时将其关闭,但它可以通过VM上的Linux帐户使用SSH密钥 . 如果您这样做,将无法获取任何帐户更改,来自Cloud Console的SSH可能会停止工作 .
如果您最终想要阻止对VM的SSH访问,那么它可能就是您想要的 .