2.4 KiB
2.4 KiB
SSH Public Key Access
Purpose
Use SSH public keys to simplify agent and computer-to-computer access without storing passwords or private keys in the knowledge base.
Rule
The knowledge base may store:
- SSH public keys (
*.pub); - public key fingerprints;
- hostnames, users, ports, and authorized-key install instructions;
- verification results.
The knowledge base must not store:
- SSH private keys;
- passwords;
- passphrases;
- credential helper stores;
- VNC passwords;
- tokens or cookies.
Standard Public-Key Exchange
For each project computer:
- Generate or locate a local SSH keypair on the computer.
- Keep the private key on that computer only.
- Commit only the public key to
locations/ssh-public-keys/<hostname>.pubor record its fingerprint inlocations/<hostname>.md. - Install the public key on target machines in the correct
authorized_keysfile. - Verify non-interactive login with
ssh -o BatchMode=yes. - Update project status and agent log.
Windows OpenSSH Notes
For normal users, use:
$keyDir = "$env:USERPROFILE\.ssh"
New-Item -ItemType Directory -Force -Path $keyDir | Out-Null
Add-Content "$keyDir\authorized_keys" "<PUBLIC_KEY_LINE>"
For administrator users, Windows OpenSSH commonly uses:
$adminKeys = "$env:ProgramData\ssh\administrators_authorized_keys"
New-Item -ItemType Directory -Force -Path (Split-Path $adminKeys) | Out-Null
Add-Content $adminKeys "<PUBLIC_KEY_LINE>"
icacls $adminKeys /inheritance:r
icacls $adminKeys /grant "SYSTEM:F" "Administrators:F"
icacls $adminKeys /remove "Users" "Authenticated Users" "Everyone"
Restart-Service sshd
Only public keys are copied.
Linux Git Server Notes
For garage, the local Git server is 192.168.1.66:/srv/git with users qore, wuu, pump, and airM1.
Install a machine public key like this:
user=<qore|wuu|pump|airM1>
install -d -m 700 -o "$user" -g "$user" "/home/$user/.ssh"
printf '%s\n' '<PUBLIC_KEY_LINE>' >> "/home/$user/.ssh/authorized_keys"
chown "$user:$user" "/home/$user/.ssh/authorized_keys"
chmod 600 "/home/$user/.ssh/authorized_keys"
Verification
ssh -o BatchMode=yes <user>@<host> hostname
git ls-remote ssh://<user>@192.168.1.66:22/srv/git/Kamaz_Cleaner.git HEAD
git push --dry-run ssh://<user>@192.168.1.66:22/srv/git/Kamaz_Cleaner.git HEAD:refs/heads/connectivity-test/<host>
Do not run real push tests unless the user explicitly approves a temporary branch.