How to enable SSH root login on Alpine Linux
On Alpine Linux, root SSH access using passwords is disabled by default. The following tutorial shows you how to enable password-based root login via SSH when using openssh . (I have not tested whether root access is enabled when installing Alpine Linux using dropbear instead of openssh )
First, open the SSH config file using
#PermitRootLogin prohibit-password
Press I in order to activate vi editing mode.
Remove the # at the beginning of the line and change prohibit-password to yes :
Now save and exit by pressing Esc and then pressing :wq and Enter .
After that, restart openssh using
Now you can login as root using the password.
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow
Search
Categories
This website uses cookies to improve your experience. We’ll assume you’re ok with this, but you can opt-out if you wish. Cookie settingsACCEPTPrivacy & Cookies Policy
Privacy Overview
This website uses cookies to improve your experience while you navigate through the website. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may have an effect on your browsing experience.
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
Overview
This article provides a short overview of SSH on Alpine Linux.
Note: This article describes two popular SSH implementations: OpenSSH and Dropbear. Either can be installed using the setup-sshd script, or by following the instructions below.
OpenSSH
OpenSSH is a popular SSH implementation for remote encrypted login to a machine. OpenSSH defines sshd as the daemon, and ssh as the client program.
Service commands
Enable the sshd service so that it starts at boot:
List services to verify sshd is enabled:
Start the sshd service immediately and create configuration files:
Note: If you are running from RAM, ensure you save your settings using the ‘lbu ci’ command as necessary. See Alpine local backup.
Fine tuning
You may wish to change the default configuration. This section describes some of the configuration options as examples, however it is by no means an exhaustive list. See the manual for full details.
The fine-tuning is done by editing /etc/ssh/sshd_config . Any line starting with «#» is ignored by sshd.
UseDNS no # By setting this to no, connection speed can increase. PasswordAuthentication no # Do not allow password authentication.
Other configuration options are shown in etc/ssh/sshd_config . The file includes comments that explain many of the options.
Firewalling and Port Changes
By default, sshd will communicate on TCP port 22.
Sometimes 22/tcp is blocked by a firewall over which you have no control. Changing the Port option to an unused port number in /etc/ssh/sshd_config may be useful in this situation.
Port 443 # Use whichever port number fits your needs
Note: Ensure the port you wish to use is not already in use by running netstat -lnp on the machine running sshd.
Restart sshd after making modifications to the configuration file:
Note: If you are running from RAM, ensure you save your settings using the ‘lbu ci’ command as necessary. See Alpine local backup.
Dropbear
Dropbear is a lightweight SSH client/server alternative to OpenSSH.
server
Add it to the default runlevel:
Use the following command to check all available server options:
The config file is located at /etc/conf.d/dropbear
client
In its simplest form it can be used like this:
(where x.x.x.x is the IP address of the remote machine).
Use dbclient -h to see all available options.