How to disable UFW ubuntu externally?

thank you for the help guys,

I found a solution to the problem. I have explained them in the below points..

  • I logged into my console and stopped the current instance
  • Then went to the volumes section and detached my volume that was associated with the present instance.
  • Then launched a new instance.
  • then attached the volume of the previous instance to the new instance
  • then logged into the new instance using ssh.
  • used lsblk command to see that block devices attached to my instance. In my case there was two i.e. the one created along with the new instance and it was the root and the next was my previous instances volume which was still not mounted.
  • then I mounted the previous volume into the instance by using the command sudo mount /dev/xvdf1 /mnt -t ext4 (Here i used xvdf1 because my data was present in that)
  • then went to /mnt/etc/ufw/ufw.conf and changed enabled=yes to enabled=no
  • saved the file and logged out
  • again visited AWS console volume section and detached the previous volume and attached it to the stopped previous instance selecting exact previous instance and path as /dev/sda1
  • went to instances tab and started the old instance.
  • Now logged into the instance and it worked like a gem and all the files were intact.

I have the same problem and found out that these steps work:

  1. Stop your instance

  2. Go to `Instance Settings -> View/Change user Data

  3. Paste this

Content-Type: multipart/mixed; boundary="//"
MIME-Version: 1.0
--//
Content-Type: text/cloud-config; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="cloud-config.txt"
#cloud-config
cloud_final_modules:
- [scripts-user, always]
--//
Content-Type: text/x-shellscript; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="userdata.txt"
#!/bin/bash
ufw disable
iptables -L
iptables -F
--//
  1. Start your instance

Hope it works for you.