How do I edit sshd_config with my users?

Hi,I'm new here and following the guide "How to secure your server".
As I was trying to "Disallow root logins over SSH" I can not edit the file.
I saw some comments down below, they said we need to add AllowUsers or AllowGroups first, and I don't know how… Please help. Or are there any other ways to solve this problem? Thanks a lot!

2 Replies

/etc/ssh/sshd_config is owned and is only writable by the super-user:

-rw-r--r-- 1 root root 3296 Oct 13 07:57 /etc/ssh/sshd_config

Disclaimer: your date & size won't match.

Consequently, you need to be logged in as the super-user to edit this file:

sudo nano /etc/ssh/sshd_config


sudo vi /etc/ssh/sshd_config

-- sw

Hi @stevewi ! Thank you so much! Just edit it.


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct