I recently bought a vps and I have am fairly new to using ubuntu on it since I have always used shared hosting.

I have created a sudoer user and it worked perfectly fine yesterday except when I edited the ssh/ssh_config file to disable password authentication, it did not work, and I decided to work on it tomorrow.

I stopped my server, and when I booted it up today, and tried the command sudo visudo /etc/ssh/ssh_config it would just put display

usage: visudo [-chqsV] [-f sudoers] [-x file]

rather than opening up the file.

I know it is something wrong about my usage but I can't seem to figure it out, I did the same exact command yesterday and it worked perfectly fine.

  • visudo is a command for editing the sudoers configuration file itself, not for editing other configuration files with administrative privileges – steeldriver Apr 21 '16 at 19:48

The command to edit a file using sudo is sudoedit:

sudoedit /etc/ssh/sshd_config

Equivalently, you can also do:

sudo -e /etc/ssh/sshd_config

visudo, as already noted, is specifically meant for editing sudoers files. It performs syntax checking assuming the file is a sudoers file. You don't want to use it to edit other files.


Use nano, visudo won't work for anything other than the sudoers config.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.