How to enable SSH root login on Alpine Linux

Nowadays I’m interested in docker and i see that docker offers Alpine Linux to use for those who are interested in container technologies nowadays. Once start searching about Alpine Linux distro everybody encourages you to use this distro on your projects. Official web site is said “Alpine Linux is a security-oriented, lightweight Linux distribution based on musl libc and busybox.”

Okay, let’s start sharing the knowledge that we have about the SSH in this point. By the way it was the most fastest Linux installation i have ever experienced thus far. In installation progress there was an option about SSH, and its packages. There were two ssh packages named openssh and dropbear-ssh, my choice was openssh, because i had no idea about the second one.

After the installation was done I tried to access the alpine but it didn’t work. I thought an existing security policy wouldn’t allow me to use a simple password for an SSH connection, then I changed my password to a complex one but that didn’t work either and I started looking for an answer to this problem and finally found it.

Open the given file using vi command.

vi /etc/ssh/sshd_config

Then find the given line.

#PermitRootLogin prohibit-password

change it with the following code, and save it.

PermitRootLogin yes

Then restart the SSH service.

service sshd restart

Now connection is open for root user.


Thanks for your time reading