Search code examples
ubuntusshnano

nano via SSH commands not working


I logged into my VPS server via SSH from my remote computer, a macbook pro. I run the command visudo to edit a config file using nano, when I am done editing the file I attempt to exit using control x or ^x (same thing). However instead of prompting me for if I want to save, like I have read, it just says this at the bottom...

--^X mode (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)

I can't even exit nano, and when I try other commands like control g nothing happens.

How do I exit nano and save the file?

Thanks


Solution

  • You're not running nano, you're running vim.

    Hit Ctrl+Z to put vim in the background and get back to your shell (you can kill vim with kill %1).

    Then export EDITOR=nano and visudo again to edit using nano.

    (To instead save and exit in Vim, use Esc to exit "^X mode", then press uppercase Z twice to save and exit).