File: setup_ssh_key_localhost

package info (click to toggle)
python-mitogen 0.3.43-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 6,816 kB
  • sloc: python: 24,940; sh: 144; makefile: 74; perl: 19; ansic: 18
file content (18 lines) | stat: -rwxr-xr-x 644 bytes parent folder | download | duplicates (2)
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