Install Arch Linux from SSH

From ArchWiki
Revision as of 00:35, 14 June 2019 by Zespri (talk | contribs) (Added tip about headless scenario. Added information about current ISO which has 'PermitRootLogin yes' already set.)
Jump to navigation Jump to search

Tango-go-next.pngThis article or section is a candidate for moving to Installation via SSH.Tango-go-next.png

Notes: Sounds better. (Discuss in Talk:Install Arch Linux from SSH#)

This article is intended to show users how to install Arch remotely via an SSH connection. Consider this approach when the host is located remotely or you wish to use the copy/paste ability of an SSH client to do the Arch install.

On the remote (target) machine

Note: These steps require physical access to the machine. If the host is physically located elsewhere, this may need to be coordinated with another person.

Boot the target machine into a live Arch environment via the Live CD/USB image: this will log the user in as root.

At this point, setup the network on the target machine as for example suggested in Installation guide#Connect to the internet.

Secondly, setup a root password which is needed for an SSH connection, since the default Arch password for root is empty:

# passwd
Tip: For headless installs, you need a working keyboard to enter these commands, which can be done blindly. Remember the exact interaction pattern of each command. For passwd for example: 'passwd' -> Enter; Type passwort -> Enter; Re-type password -> Enter.

Now check that PermitRootLogin yes is present (and uncommented) in /etc/ssh/sshd_config. This setting allows root login with password authentication on the SSH server. With the current ISO (2019-06-01), this option is already set accordingly.

Finally, start the openssh daemon with sshd.service, which is included by default on the live CD.

Note: Unless required, after installation it is recommended to remove PermitRootLogin yes from /etc/ssh/sshd_config.
Tip: If the target machine is behind a NAT router, and you require external access, the SSH port (22 by default) will need to be forwarded to the target machine's LAN IP address.

On the local machine

On the local machine, connect to the target machine via SSH with the following command:

$ ssh

From here one is presented with the live environment's welcome message and is able to administer the target machine as if sitting at the physical keyboard. At this point, if the intent is to simply install Arch from the live media, follow the guide at Installation guide. If the intent is to edit an existing Linux install that got broken, follow the Install from existing Linux wiki article.

Tip: Consider installing a terminal multiplexer on the target machine's live (in memory) system, so that if you are disconnected you can reattach to your multiplexer's session.