SSH with VSCode && solve "Bad Permission"/"Permission Too Open" problem for Win10 + Linux

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
i will demonstrate how you can connect to your server with a vs code and ssh so the first part of this video will be for windows and the second part will be for a linux system so in vs code you will need to install remote development extension so it's going to install these four extensions it's a bundle and what we are going to use is ssh and ssh editing configuration files so once the installation is completed you can find this icon here and you choose ssh targets from the drop down add new and you will need to end enter the command for connecting your server uh for this part you will need your server's ip address so for me i use aws server so i can find the ip address here you can also use dns other than your ip address you also need your username for your server so i use the ubuntu server on the best by default the username is ubuntu so i'm gonna connect ubuntu and add at enter then you need to choose your ssh configuration file i will choose the first one and you will need to remember this file address hopefully you have this option to open the configuration file if not you have the option to go to your c drive users your username and dot ssh so that's the address you remembered from here you can also find this configuration file and you can open here so this is the ip address i just added for host you can change it to any name you like i will make it aws server host name is either ip address or dns user is ubuntu which i just entered and you need another thing called identity file for some servers that does not require a key file or identity file to login you will need password login so for example this one going to prompt you for your password and you can enter it and log in that's easy but for my aws server it requires a key file uh it has an extension of dot pam just like this one so we will need a key file this key file can be downloaded when you create your server i downloaded this file when i create my server from aws so i have this key file stored here i'm gonna download it it's right here so i'm gonna copy it and place it here okay let me copy the address and paste it here backslash and i will also need the file name just like this one after configuring the configuration file we can refresh remember that you have to refresh the the host will change and if you don't refresh uh it may not recognize this file and after refreshing connect you may encounter some problem so if you look into the logs you can find the reason so bad permissions uh so the key file permission for this key file is to open and it says your private key files are not accessible by others okay so we know the reason and we want to fix it so if we open properties of this file and go to security you can see that there are some groups and users these are the people who have access to this file so the reason it complains about permission is it's too open so i want to make this file only accessible to myself i will remove every single one of them and i will do this by disable inheritance first and inherited from will be all known then i can remove them i will remove everyone and add myself so here uh you can copy this paste it so i it's my pc name you need to copy your pc name and add the backslash and your username your current username you can find your current username from c drive users and here is your username check names if nothing displayed that means uh your username is correct so okay apply okay so you see that uh the the owner of this file is only myself and i have read access and and execute access to it okay now we refresh and connect again it's connected so if i open the terminal you can see that this is my username i'm connected to my adabs server for the second part of the video i'm gonna demonstrate the same thing for linux so here i have a ubuntu and we need to install remote development and the process is basically the same except for the location of the ssh configuration file so i will go very fast i will download my key file copy the ip address and it's my username your username can be found here in case you don't know so enter so uh i will need to put the configuration file okay i will show you the location using home and dot ssh is right here because you can open here so i will change the name you don't have to change it identity file and my identity file is in downloads folder here so the address is downloads and the file name refresh and connect so the same issue if you look at the log it will say the permission is too open and cannot be accessible by others so you will do the same thing i will open the terminal here if we look at the permissions for this private key file you can see that for me i have read and write access for group and others we also have read access so that's what we don't want so we can do this um i will change to four zero zero and the file name so four zero zero means only myself can read it so if you have you can also change it to 600 so you only myself can read and write it now it should be okay yeah i'm connected it's similar for windows and linux for mac it's the same as linux the location of the ssh configuration file is the same it will be under home your username and dot ssh so basically it's home dot ssh and config
Info
Channel: Huakun
Views: 9,570
Rating: undefined out of 5
Keywords: server, ssh, vscode, aws, ec2, permission
Id: AQl4JS-kwns
Channel Id: undefined
Length: 10min 18sec (618 seconds)
Published: Thu May 28 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.