From 7ff680bef775ca76fb6c9cf28aadca7b2b98415a Mon Sep 17 00:00:00 2001 From: Manoj Ampalam Date: Mon, 9 Apr 2018 11:52:57 -0700 Subject: [PATCH] Updated ssh.exe examples (markdown) --- ssh.exe-examples.md | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/ssh.exe-examples.md b/ssh.exe-examples.md index 2737a33..ce90ba2 100644 --- a/ssh.exe-examples.md +++ b/ssh.exe-examples.md @@ -12,31 +12,22 @@ ### Usage from client-side (`ssh`) -1. Generate a key pair on the client: +1. Generate a key pair on the client (preferably with a passphrase): * `ssh-keygen -t rsa -f id_rsa` - * If you're using an existing key pair generated by `ssh-keygen` before installing build [v0.0.13.0][build13], make sure they are [secured][Secure file]. -2. Register [secured][Secure file] private key with ssh-agent (for single sign-on experience) +2. Register private key with ssh-agent (optional, for single sign-on experience) * `net start ssh-agent` * `ssh-add id_rsa` -3. Login using [secured][Secure file] private key +3. Login using private key * `ssh -i .\id_rsa user@host` (workgroup 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\\.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\\.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 -``` +2. Double check permission on authorized_keys (only System, Administrators and owner can have access). ### For Unix and Linux users The [Modern Unix Rosetta Stone](https://certsimple.com/rosetta-stone) includes PowerShell examples of common Unix and Linux commands. [Secure file]: https://github.com/PowerShell/Win32-OpenSSH/wiki/Security-protection-of-various-files-in-win32-openssh -[build13]: https://github.com/PowerShell/Win32-OpenSSH/releases/tag/v0.0.13.0 \ No newline at end of file