Why should i change the permissions on the ssh pem file?

0

Amazon recommends to run the command chmod 400 key.pem on my pem key to prevent the key from being publicly viewable.

I am on a windows computer and i can't make an ssh connection with cmd.exe if the permissions on the pem key haven't been changed yet. However I can use the unaltered key to make an ssh connection when using other applications like MySQL workbench or FileZilla. Neither workbench nor filezilla throw any kind of error.

So how unsafe is it really to use the pem key as-is without first restricting its permissions via the command chmod 400 key.pem. Does it make the SSH connection less secure? I don't really understand what amazon means with 'to prevent the key from being publicly viewable'.

Thanks

1 Risposta
2
Risposta accettata

Your private key is like a password, and so it should only be accessible by YOU. Changing the permissions in Linux to 400 is recommended because it makes the private key file readable by you ONLY. In Windows, the equivalent would be removing all permissions from the private key, disabling inheritance, and giving yourself read permissions.

profile pictureAWS
ESPERTO
Matt-B
con risposta 2 anni fa
profile pictureAWS
ESPERTO
verificato 2 anni fa
  • thank you for your answer. So all chmod does is prevent other users on the same machine from accessing the .pem file correct? It does not improve the security of the ssh connection itself, right?

  • That correct, the ssh protocol/session is still encrypted and functions the same way.

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande