mirror of
https://github.com/PowerShell/Win32-OpenSSH.git
synced 2025-07-26 07:25:25 +02:00
Updated ssh.exe examples (markdown)
parent
27be1ad6d8
commit
fffccc2a40
@ -10,18 +10,6 @@
|
|||||||
|
|
||||||
## Login With SSH Keys
|
## Login With SSH Keys
|
||||||
|
|
||||||
### Setup server-side (`sshd`)
|
|
||||||
|
|
||||||
1. Copy `id_rsa.pub` (client's public key) to corresponding user's directory on the SSH server at `%systemdrive%\Users\<user>\.ssh\authorized_keys`
|
|
||||||
2. Make sure the authorized_keys file is [secured][Secure file] (you may need to re-ACL it) and "NT Service\sshd" has Read access to it
|
|
||||||
```powershell
|
|
||||||
$authorizedKeyPath = "%systemdrive%\users\<user>\.ssh\authorized_keys"
|
|
||||||
$acl = Get-Acl $authorizedKeyPath
|
|
||||||
$ar = New-Object System.Security.AccessControl.FileSystemAccessRule("NT Service\sshd", "Read", "Allow")
|
|
||||||
$acl.SetAccessRule($ar)
|
|
||||||
Set-Acl $authorizedKeyPath $acl
|
|
||||||
```
|
|
||||||
|
|
||||||
### Usage from client-side (`ssh`)
|
### Usage from client-side (`ssh`)
|
||||||
|
|
||||||
1. Generate a key pair on the client:
|
1. Generate a key pair on the client:
|
||||||
@ -34,6 +22,18 @@ Set-Acl $authorizedKeyPath $acl
|
|||||||
* `ssh -i .\id_rsa user@host` (workgroup user)
|
* `ssh -i .\id_rsa user@host` (workgroup user)
|
||||||
* `ssh -i .\id_rsa -l user@domain host` (domain user)
|
* `ssh -i .\id_rsa -l user@domain host` (domain user)
|
||||||
|
|
||||||
|
### Setup server-side (`sshd`)
|
||||||
|
|
||||||
|
1. Copy `id_rsa.pub` (client's public key) to corresponding user's directory on the SSH server at `%systemdrive%\Users\<user>\.ssh\authorized_keys`
|
||||||
|
2. Make sure the authorized_keys file is [secured][Secure file] (you may need to re-ACL it) and "NT Service\sshd" has Read access to it
|
||||||
|
```powershell
|
||||||
|
$authorizedKeyPath = "%systemdrive%\users\<user>\.ssh\authorized_keys"
|
||||||
|
$acl = Get-Acl $authorizedKeyPath
|
||||||
|
$ar = New-Object System.Security.AccessControl.FileSystemAccessRule("NT Service\sshd", "Read", "Allow")
|
||||||
|
$acl.SetAccessRule($ar)
|
||||||
|
Set-Acl $authorizedKeyPath $acl
|
||||||
|
```
|
||||||
|
|
||||||
### For Unix and Linux users
|
### For Unix and Linux users
|
||||||
|
|
||||||
The [Modern Unix Rosetta Stone](https://certsimple.com/rosetta-stone) includes PowerShell examples of common Unix and Linux commands.
|
The [Modern Unix Rosetta Stone](https://certsimple.com/rosetta-stone) includes PowerShell examples of common Unix and Linux commands.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user