Copy-SshId
2.1.0
向目标主机安装SSH公钥实现免密登录,或从目标主机移除本机公钥恢复密码登录。
语法:
安装公钥:Copy-SshId [用户@]主机 [-RemoteUser 用户] [-RemotePort 端口] [-KeyFile 公钥路径]
别名:-RemoteUser=-l -RemotePort=-p -KeyFile=-i
例:Copy-SshId root@192.168.1.10
Copy-SshId 192.168.1.10 -l root -p 2222 -i C:\Users\xxx\.ssh\id_ed25519.pub
未指定 -KeyFile 时自动选用 ~\.ssh 下第一个可用公钥;免密已生效时直接跳过。
移除公钥:Remove-SshId [用户@]主机
语法:
安装公钥:Copy-SshId [用户@]主机 [-RemoteUser 用户] [-RemotePort 端口] [-KeyFile 公钥路径]
别名:-RemoteUser=-l -RemotePort=-p -KeyFile=-i
例:Copy-SshId root@192.168.1.10
Copy-SshId 192.168.1.10 -l root -p 2222 -i C:\Users\xxx\.ssh\id_ed25519.pub
未指定 -KeyFile 时自动选用 ~\.ssh 下第一个可用公钥;免密已生效时直接跳过。
移除公钥:Remove-SshId [用户@]主机
向目标主机安装SSH公钥实现免密登录,或从目标主机移除本机公钥恢复密码登录。
语法:
安装公钥:Copy-SshId [用户@]主机 [-RemoteUser 用户] [-RemotePort 端口] [-KeyFile 公钥路径]
别名:-RemoteUser=-l -RemotePort=-p -KeyFile=-i
例:Copy-SshId root@192.168.1.10
Copy-SshId 192.168.1.10 -l root -p 2222 -i C:\Users\xxx\.ssh\id_ed25519.pub
未指定 -KeyFile 时自动选用 ~\.ssh 下第一个可用公钥;免密已生效时直接跳过。
移除公钥:Remove-SshId [用户@]主机 [-RemoteUser 用户] [-RemotePort 端口] [-KeyFile 公钥路径]
例:Remove-SshId root@192.168.1.10
仅在当前可免密登录时执行;未指定 -KeyFile 时移除 ~\.ssh 下所有公钥对应条目。
Show more
语法:
安装公钥:Copy-SshId [用户@]主机 [-RemoteUser 用户] [-RemotePort 端口] [-KeyFile 公钥路径]
别名:-RemoteUser=-l -RemotePort=-p -KeyFile=-i
例:Copy-SshId root@192.168.1.10
Copy-SshId 192.168.1.10 -l root -p 2222 -i C:\Users\xxx\.ssh\id_ed25519.pub
未指定 -KeyFile 时自动选用 ~\.ssh 下第一个可用公钥;免密已生效时直接跳过。
移除公钥:Remove-SshId [用户@]主机 [-RemoteUser 用户] [-RemotePort 端口] [-KeyFile 公钥路径]
例:Remove-SshId root@192.168.1.10
仅在当前可免密登录时执行;未指定 -KeyFile 时移除 ~\.ssh 下所有公钥对应条目。
Installation Options
Owners
Copyright
(c) 2026 埃博拉酱. All rights reserved.
Package Details
Author(s)
- 埃博拉酱
Dependencies
This module has no dependencies.
Release Notes
修复Linux上的语法错误问题
FileList
- Copy-SshId.nuspec
- Copy-SshId.psd1
- Copy-SshId.psm1
- Install-SshKey.ps1
- Read-SshPassword.ps1
- Uninstall-SshKey.ps1
Version History
| Version | Downloads | Last updated |
|---|---|---|
| 2.1.0 (current version) | 12 | 8/4/2026 |
| 2.0.0 | 37 | 6/30/2026 |