1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2026 Mitogen authors <https://github.com/mitogen-hq>
# SPDX-License-Identifier: BSD-3-Clause
set -o errexit -o nounset -o pipefail
if [[ ! -f ~/.ssh/id_rsa ]]; then
ssh-keygen -P '' -m pem -f ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
chmod u=rwx,go= ~/.ssh
chmod u=rw,go= ~/.ssh/authorized_keys
fi
if sudo test ! -f ~root/.ssh/id_rsa; then
sudo ssh-keygen -P '' -m pem -f ~root/.ssh/id_rsa
sudo cat ~root/.ssh/id_rsa.pub | sudo tee -a ~root/.ssh/authorized_keys
sudo chmod u=rwx,go= ~root/.ssh
sudo chmod u=rw,go= ~root/.ssh/authorized_keys
fi
|