大网数据广告活动
服务器运维问答

Changed AWS EC2 firewall rule and locked out of ssh

· 52CE 我爱测

I have an AWS EC2 instance using SLES15. I manually edited /etc/sysconfig/SuSEfirewall2 to open some ports. I messed up the FW_SERVICES_EXT_TCP because I thought I am adding on top of what's already enabled which is sshd. But aft…

问题原文

原帖链接 · Richard · CC BY-SA 4.0

I have an AWS EC2 instance using SLES15. I manually edited /etc/sysconfig/SuSEfirewall2 to open some ports. I messed up the FW_SERVICES_EXT_TCP because I thought I am adding on top of what's already enabled which is sshd. But after reload the rule. sshd port is blocked and I can no longer get back in to fix it. Any options besides using another instance to mount the root volume from the messed up instance?

Thanks in advance.

已采纳解答

原帖链接 · MLu · CC BY-SA 4.0

I'm afraid not. Other than restoring from a snapshot or reinstalling from scratch your best option is probably using another EC2 instance to fix the file.

  1. Shut down your SLES instance (don't terminate)
  2. Note down what the root volume device name is (probably /dev/sda1 or /dev/xvda)
  3. Detach the volume and attach to another helper instance.
  4. Fix the firewall file.
  5. Unmount and detach the volume from the helper instance and re-attach to the original one under the correct name (/dev/sda1 or /dev/xvda)
  6. Start up and SSH in :)

Hope that helps.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-09-23)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。