From dbbf55a20d2c81ae091225195d891e07d8485f2b Mon Sep 17 00:00:00 2001 From: Yanbing Date: Fri, 2 Jun 2017 19:24:02 -0700 Subject: [PATCH] Updated OpenSSH utility scripts to fix file permissions (markdown) --- ...utility-scripts-to-fix-file-permissions.md | 37 +++++++++++++++---- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/OpenSSH-utility-scripts-to-fix-file-permissions.md b/OpenSSH-utility-scripts-to-fix-file-permissions.md index fbfc464..0b88625 100644 --- a/OpenSSH-utility-scripts-to-fix-file-permissions.md +++ b/OpenSSH-utility-scripts-to-fix-file-permissions.md @@ -1,15 +1,36 @@ Powershell utility scripts are included starting release [V0.0.15.0](https://github.com/PowerShell/Win32-OpenSSH/releases/tag/v0.0.15.0) to help you fix the permissions on various keys and configuration files. - - `FixHostFilePermissions.ps1`: check and fix the permission on default host files: - - user's authorized_keys located at ```$env:systemdrive\Users\...\.ssh\authorized_keys``` - - host keys generated by `ssh-keygen.exe -A` in the same folder of the script - - sshd_config in the same folder of the script + - `FixHostFilePermissions.ps1`: checks and fixes the below permission on default host files. + - user's authorized_keys located at ```$env:systemdrive\Users\...\.ssh\authorized_keys``` + - host keys generated by `ssh-keygen.exe -A` in the same folder of the script + - sshd_config in the same folder of the script + +```PowerShell +# -Quiet suppresses prompting to confirm you want to update each permission +.\FixHostFilePermissions.ps1 -Quiet +``` - `FixUserFilePermissions.ps1`: check and fix the file permission for user's default files: - - user's ssh_config located at ~\.ssh\config - - user's keys located at ~\.ssh\id_rsa, id_rsa.pub - - user's keys located at ~\.ssh\id_dsa, id_dsa.pub + - user's ssh_config located at ~\.ssh\config + - user's keys located at ~\.ssh\id_rsa, id_rsa.pub + - user's keys located at ~\.ssh\id_dsa, id_dsa.pub + +```PowerShell +# -Quiet suppresses prompting to confirm you want to update each permission +.\FixUserFilePermissions.ps1 -Quiet +``` - Powershell module `OpenSSHUtils.psm1` helps to check and fix customer specified files. - Function `Fix-HostSSHDConfigPermissions` fix the sshd_config file specified by user - Function `Fix-HostKeyPermissions` fix the permission for host keys specified by user - Function `Fix-UserKeyPermissions` fix the the permissions for user's key files specified by user - Function `Fix-AuthorizedKeyPermissions` fix the permissions for the authorized_keys file specified by user - - Function `Fix-UserSSHConfigPermissions` fix the permissions for user's ssh config specified by user \ No newline at end of file + - Function `Fix-UserSSHConfigPermissions` fix the permissions for user's ssh config specified by user + +```PowerShell +import-module .\OpenSSHUtils.psm1 -force +# prompt to confirm you want to confirm you want to update each permission on the file +Fix-HostSSHDConfigPermissions c:\test\sshd_config +# -Quiet suppresses prompting to confirm you want to update each permission on the file +Fix-HostKeyPermissions -FilePath c:\test\sshtest_userssokey_ed25519 -Quiet +Fix-AuthorizedKeyPermissions -FilePath C:\Users\sshtest_ssouser\.ssh\authorized_keys -Quiet +Fix-HostUserPermissions -FilePath c:\test\sshtest_hostkey_ecdsa -Quiet +Fix-UserSSHConfigPermissions -FilePath ~\.ssh\config -Quiet +``` \ No newline at end of file