You are not logged in.
The goal: setup a customized ("releng") Arch ISO so that immediately on boot,
sshd
is started and there is a
/root/.ssh/authorized_keys
file in place so that one can login without using a password. I've added
openssh
to the packages.both file, and copied an
/etc/ssh/sshd_config
into
archlive/releng/root-image/etc/ssh/
. What else needs to be done?
Last edited by justinzane (2014-03-02 19:47:17)
Offline
The same thing to you do on your system:
systemctl enable sshd.socket
Offline
I did the `systemctl enable sshd.service` in `archlive/releng/root-image/root/customize_root_install.sh`. Forgot to mention that. What I do not inderstand is:
- do i need to add `systemctl enable sshd.service` in `archlive/releng/root-image/root/customize_root_install.sh` so that ssh works on boot?
- what else, if anything, do i need to copy to `archlive/releng/root-image/etc/ssh/`?
- where do I put the `authorized_keys` file?
- what needs to go in `archlive/releng/root-image/etc/netctl/`, if anything, so that I can be sure that the system will autoconnect to any wired interface using dhcp?
- autoconnect to any open 802.11 network on boot?
- autoconnect to a specific netctl.profile on boot?
- anything else to ensure that, assuming the system boots from the CustomArchLive media, no direct input is needed -- everything beyond boot is able to be done via ssh?
Last edited by justinzane (2014-03-02 00:54:56)
Offline
The same thing to you do on your system:
systemctl enable sshd.socket
Unfortunately, that does not work...
### root-image/root/customize_root_image.sh
...
systemctl enable multi-user.target pacman-init.service choose-mirror.service
systemctl enable netctl.service
systemctl start netctl.service
netctl enable wired_dhcp
netctl enable wireless-ZANE
netctl start wired_dhcp
netctl start wireless-ZANE
systemctl enable sshd.service
systemctl start sshd.service
end up with the following messages:
Generation complete.
ln -s '/usr/lib/systemd/system/multi-user.target' '/etc/systemd/system/default.target'
ln -s '/etc/systemd/system/pacman-init.service' '/etc/systemd/system/multi-user.target.wants/pacman-init.service'
ln -s '/etc/systemd/system/choose-mirror.service' '/etc/systemd/system/multi-user.target.wants/choose-mirror.service'
ln -s '/usr/lib/systemd/system/netctl.service' '/etc/systemd/system/multi-user.target.wants/netctl.service'
Running in chroot, ignoring request.
en-any: using interface enp9s0
ln -s '/etc/systemd/system/netctl@wired_dhcp.service' '/etc/systemd/system/multi-user.target.wants/netctl@wired_dhcp.service'
Running in chroot, ignoring request.
wl-any: using interface wlp7s0
ln -s '/etc/systemd/system/netctl@wireless\x2dZANE.service' '/etc/systemd/system/multi-user.target.wants/netctl@wireless\x2dZANE.service'
Running in chroot, ignoring request.
Running in chroot, ignoring request.
Running in chroot, ignoring request.
ln -s '/usr/lib/systemd/system/sshd.service' '/etc/systemd/system/multi-user.target.wants/sshd.service'
Running in chroot, ignoring request.
So, how does one convince systemctl to work in chroot?
Offline
I'm sure you could probably manually make the symlink in releng/root-image/etc/systemd/system.
Offline
Apologies to djgera... It does. Just need to remove the "start" lines.
Unfortunately, that does not work...
### root-image/root/customize_root_image.sh ... systemctl enable multi-user.target pacman-init.service choose-mirror.service systemctl enable netctl.service [del]systemctl start netctl.service[/del] netctl enable wired_dhcp netctl enable wireless-ZANE [del]netctl start wired_dhcp[/del] [del]netctl start wireless-ZANE[/del] systemctl enable sshd.service [del]systemctl start sshd.service[/del]
The only other fix needed is to put the
.ssh/authorized_keys
into
archlive/releng/root-image/etc/skel/
since that is apparently the only way to get files into the subsequent /root/ user directory.
Offline
I'm sure you could probably manually make the symlink in releng/root-image/etc/systemd/system.
Thanks, but I was just reading without care. The `systemctl enable ...` lines work. It was the `systemctl start ...` lines that failed. And, once I tested the resulting USB stick, I had an IP address and a working ssh daemon.
Offline
Please mark this thread as solved.
Offline
Just wanted to add a comment for anyone else trying to do this.
If you want to be able to log in without adding your public key to the archiso, you can enable login with an empty password (the default root password on archiso):
# mkdir airootfs/ssh
# cp /etc/ssh/sshd_config airootfs/etc/ssh/
# <editor> airootfs/etc/ssh/sshd_config
Uncomment and set to yes the following settings:
PasswordAuthentication yes
PermitEmptyPasswords yes
Offline