chmod 600 ~/.ssh/id_rsa; chmod 600 ~/.ssh/id_rsa.pub (i.e.
chmod u=rw,go= ~/.ssh/id_rsa ~/.ssh/id_rsa.pub) are correct.
chmod 644 ~/.ssh/id_rsa.pub (i.e.
chmod a=r,u+w ~/.ssh/id_rsa.pub) would also be correct, but
chmod 644 ~/.ssh/id_rsa (i.e.
chmod a=r,u+w ~/.ssh/id_rsa) would not be. Your public key can be public, what matters is that your private key is private.
.ssh directory itself must be writable only by you:
chmod 700 ~/.ssh or
chmod u=rwx,go= ~/.ssh. You of course need to be able to read it and access files in it (execute permission). It isn’t directly harmful if others can read it, but it isn’t useful either.
You don’t need
sudo. Don’t use
sudo to manipulate your own files, that can only lead to mistakes.
The error about
.ICEauthority is not related to the
chmod commands you show. Either it’s a coincidence or you ran some other commands that you aren’t showing us.
# Set public/private key permissions # Octal form chmod 600 ~/.ssh/id_rsa chmod 600 ~/.ssh/id_rsa.pub # Equivalent literal form chmod u=rw,go= ~/.ssh/id_rsa ~/.ssh/id_rsa.pub # Optional: make public key readable chmod 644 ~/.ssh/id_rsa.pub # chmod a=r,u+w ~/.ssh/id_rsa.pub # Set directory permissions chmod 700 ~/.ssh # chmod u=rwx,go= ~/.ssh # Legend for literal form # +: allow -: deny =: reset and allow # u: user r: read # g: group w: write # o: others x: execute # a: all