google 云恢复 sshd_config
google cloud restore sshd_config
我在 google 云计算引擎 VM 实例上搞砸了我的 /etc/ssh/sshd_config。所以我不能再通过 ssh 连接。有没有办法恢复文件并重新获得 ssh 访问权限,而不是重新开始?
我在文件中添加了以下行。我以为它会在用户通过 sftp 连接时将 testuser 的默认文件夹设置为 testfolder。
Subsystem sftp internal-sftp -u testuser -l INFO -d /mnt/disks/testfolder
然后我注释掉了这行
Subsystem sftp /usr/lib/openssh/sftp-server
我想我不应该那样做。
您有两种修改文件的方法:
1) Connecting to the VM using the serial console. I believe this will only work if you have setup already a password for your user. Then you will be able to log in and edit the file. Other details can be found here.
2) 采用与“Inspect an instance without shutting it down”部分类似的方法。这基本上意味着:
a) Delete the VM but making sure to keep the disk (--keep-disk=all).If you want to go on the safe side, you could also take a snapshot of the disk and make a new disk from it.
b) Spin a new VM 可以正常开机
c) Attach the failing disk 或其副本到此新 VM
d) 在 Linux FS 上安装附加磁盘。
e) 编辑 SSH 配置文件。
f) 分离磁盘。
g) 使用修改后的磁盘旋转一个新的 VM。
我在 google 云计算引擎 VM 实例上搞砸了我的 /etc/ssh/sshd_config。所以我不能再通过 ssh 连接。有没有办法恢复文件并重新获得 ssh 访问权限,而不是重新开始?
我在文件中添加了以下行。我以为它会在用户通过 sftp 连接时将 testuser 的默认文件夹设置为 testfolder。
Subsystem sftp internal-sftp -u testuser -l INFO -d /mnt/disks/testfolder
然后我注释掉了这行
Subsystem sftp /usr/lib/openssh/sftp-server
我想我不应该那样做。
您有两种修改文件的方法:
1) Connecting to the VM using the serial console. I believe this will only work if you have setup already a password for your user. Then you will be able to log in and edit the file. Other details can be found here.
2) 采用与“Inspect an instance without shutting it down”部分类似的方法。这基本上意味着:
a) Delete the VM but making sure to keep the disk (--keep-disk=all).If you want to go on the safe side, you could also take a snapshot of the disk and make a new disk from it.
b) Spin a new VM 可以正常开机
c) Attach the failing disk 或其副本到此新 VM
d) 在 Linux FS 上安装附加磁盘。
e) 编辑 SSH 配置文件。
f) 分离磁盘。
g) 使用修改后的磁盘旋转一个新的 VM。