Step 1: boot into rescue mode
Some server provider provide feature Reload Operating System
Step 2: find mount root filesystem
root@sysresccd /root % fdisk -l Disk /dev/sda: 119.2 GiB, 128035676160 bytes, 250069680 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x000613a7 Device Boot Start End Blocks Id System /dev/sda1 2048 6143 2048 83 Linux /dev/sda2 * 6144 1030143 512000 83 Linux /dev/sda3 1030144 250068991 124519424 8e Linux LVM Disk /dev/sdb: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disklabel type: dos Disk identifier: 0x00006199 Device Boot Start End Blocks Id System /dev/sdb1 2048 3907029167 1953513560 83 Linux Disk /dev/mapper/vg-swap: 7.8 GiB, 8321499136 bytes, 16252928 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk /dev/mapper/vg-tmp: 1 GiB, 1073741824 bytes, 2097152 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk /dev/mapper/vg-root: 110 GiB, 118107406336 bytes, 230678528 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes
Step 3: mount root filesystem
root@sysresccd / % mkdir /old
root@sysresccd / % mount -t ext4 /dev/mapper/vg-root /old
Step 4: do your fix
Example edit file /old/etc/ssh/sshd_config
Step 5: reboot into regular mode
Done!