Menu

8/6/25

Enable ssh with root user in almalinux

 By default, SSH root login is disabled on AlmaLinux for security reasons. To enable it, you need to edit the SSH daemon's configuration file.

1. Edit the SSH Configuration File

vi /etc/ssh/sshd_config.d/mycf.conf

2. Add the PermitRootLogin Directive

PermitRootLogin yes

3. Save and Close the File

  • If you're using nano, press Ctrl + X, then Y, and then Enter to save the changes.


4. Restart the SSH Service

For the changes to take effect, you must restart the sshd service.

sudo systemctl restart sshd

Now, you should be able to log in to your AlmaLinux server as the root user via SSH. However, it is strongly recommended that you use a non-root user for daily administration and only use the sudo command when necessary, as enabling root SSH can pose a significant security risk.

Check logs: [root@vnpt ~]#  journalctl -u sshd


No comments:

Post a Comment