WSL will start in your C:\Users{user} directory.
Put the file in /home/{user}, then change the permissions.
Answer from Alymsin on Stack Exchangeamazon web services - Set pem file permissions for AWS without chmod on Windows - Stack Overflow
shell - chmod 400 command returning "No such file or directory" error. Trying to launch an instance through AWS - Unix & Linux Stack Exchange
linux - Not able access a file when using chmod 400 - Stack Overflow
I guess I broke Linux? I ran "chmod 400 chmod" and now if I run chmod I get permission denied. Help?
http://www.linuxnetadmin.com/2013/05/permissions-broken-on-binchmod.html
edit: easy mode fix!
More on reddit.comVideos
Here's a working version of Mayur's code
icacls.exe your_key_name.pem /reset
icacls.exe your_key_name.pem /grant:r %username%:(R)
icacls.exe your_key_name.pem /inheritance:r
Here is the script to give 400 permission to a pem file on windows.
This is similar to $ chmod 400 your_key_name.pem
icacls.exe your_key_name.pem /reset
icacls.exe your_key_name.pem /grant:r "
env:username):(r)"
icacls.exe your_key_name.pem /inheritance:r
Just copy the above lines and replace your_key_name.pem with your pem file. And paste one by one on your CMD
This is an ARM-based quadcopter running a very stripped down linux distro. My group is "hacking" it as part of a class project. Basically all I can do is telnet into it after it boots and use the bash terminal (which is missing a LOT of standard commands like useradd and sudo). So livecd isn't an option here. I was hoping against hope someone might know a command line fix for this.
http://www.linuxnetadmin.com/2013/05/permissions-broken-on-binchmod.html
edit: easy mode fix!
/lib/ld-so-linux.so /usr/bin/chmod +x /usr/bin/chmod something like that
/lib/ld-linux-x86-64.so.2 /usr/bin/chmod +x /usr/bin/chmod
Thats the one, that did it.
You see ld-so-linux.so is the interpreter of ELF files and you can give it an ELF file to run even if its bits arent set as executable.
The keys need to be read-writable only by you:
chmod 600 ~/.ssh/id_rsa
Alternatively, the keys can be only readable by you (this also blocks your write access):
chmod 400 ~/.ssh/id_rsa
600 appears to be better in most cases, because you don't need to change file permissions later to edit it. (See the comments for more nuances)
The relevant portion from the manpage (man ssh)
~/.ssh/id_rsa Contains the private key for authentication. These files contain sensitive data and should be readable by the user but not accessible by others (read/write/execute). ssh will simply ignore a private key file if it is accessible by others. It is possible to specify a passphrase when generating the key which will be used to encrypt the sensitive part of this file using 3DES. ~/.ssh/identity.pub ~/.ssh/id_dsa.pub ~/.ssh/id_ecdsa.pub ~/.ssh/id_rsa.pub Contains the public key for authentication. These files are not sensitive and can (but need not) be readable by anyone.
Using Cygwin in Windows 8.1, there is a command need to be run:
chgrp Users ~/.ssh/id_rsa
Then the solution posted here can be applied, 400 or 600 is OK.
chmod 600 ~/.ssh/id_rsa
Reference here
Well - so you made /usr readable only to root, I guess (if no further changes). More over - you removed "x" by that which made the folder pretty much not accessible. Hence you can't now - as regular user - run sudo, which, if I remember correctly, is in /usr/bin/.
The best idea for now would be to start a system from LiveCD, mount your disk/filesystem and change the permissions back to 755.
And next time to be more careful with this kind of changes ;)
If you have things resolved, assign a password to the root user so you can login directly as root should you ever need to.
Permissions 0777 for '/mnt/c/Users/onwin/source/repos/.ssh/id_ed25519' are too open.
It is required that your private key files are NOT accessible by others.
I tried sudo chmod 600 ~/.ssh/id_ed25519
but same error, and changing it to 400 just gives me the same error, but with Permissions 0555
instead.
This happens when i'm trying to ssh-add. What am I doing wrong?
Doing ls -l gives me -r-xr-xr-x 1 lilbluey lilbluey 464 Oct 20 11:50 /mnt/c/Users/onwin/source/repos/.ssh/id_ed25519
~ leads to ..../source/repos as I changed the /etc/passwd file for this user.
Is it an issue with chmod 400 being too lax? I thought it meant the highest level of security.
or maybe my ~ shouldn't be in /source/repos?
For context, generated ssh key for github, but this error happened when doing ssh-add