Connect AWS Lightsail Instance using Powershell and SSH key

Published: 04 September 2024
on channel: Dev Forge
696
7

#devops #aws #lightsail #docker #ubuntu22

👉 Follow the below code and instructions to change the ssh key permission:

Move the ssh key (.pem) file to the target directory (.ssh) and run the below command on pwsh, but don't forget to replace the actual file
$pemFile = "$HOME\.ssh\test_ssh.pem"
$acl = Get-Acl $pemFile
$acl.SetAccessRuleProtection($true, $false) # Disable inheritance
$acl.Access | ForEach-Object { $acl.RemoveAccessRule($_) } # Remove existing rules

Add your user account with Full Control
$accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule("$(whoami)", "FullControl", "Allow")
$acl.AddAccessRule($accessRule)
Set-Acl $pemFile $acl


On this page of the site you can watch the video online Connect AWS Lightsail Instance using Powershell and SSH key with a duration of hours minute second in good quality, which was uploaded by the user Dev Forge 04 September 2024, share the link with friends and acquaintances, this video has already been watched 696 times on youtube and it was liked by 7 viewers. Enjoy your viewing!