elicro gist felülvizsgálása . Revízióhoz ugrás
1 file changed, 16 insertions
add-ssh-copy-id.ps1(fájl létrehozva)
| @@ -0,0 +1,16 @@ | |||
| 1 | + | $FunctionCode = @' | |
| 2 | + | function ssh-copy-id { | |
| 3 | + | param([Parameter(Mandatory=$true)][string]$RemoteTarget) | |
| 4 | + | $KeyPath = "$env:USERPROFILE\.ssh\id_ed25519.pub" | |
| 5 | + | if (!(Test-Path $KeyPath)) { | |
| 6 | + | Write-Error "Public key not found at $KeyPath" | |
| 7 | + | return | |
| 8 | + | } | |
| 9 | + | $PubKey = Get-Content $KeyPath | |
| 10 | + | ssh $RemoteTarget "mkdir -p ~/.ssh && chmod 700 ~/.ssh && echo '$PubKey' >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys" | |
| 11 | + | } | |
| 12 | + | '@ | |
| 13 | + | ||
| 14 | + | Add-Content -Path $PROFILE -Value $FunctionCode | |
| 15 | + | ||
| 16 | + | . $PROFILE | |
Újabb
Régebbi