This question already has an answer here:

I can change the permissions of a file by:

chmod 600 ~/.ssh/authorized_keys

How can I retrieve the permissions of a file in the same format which is 600?

marked as duplicate by ctrl-alt-delor, Stephen Harris, Jeff Schaller, slm Jul 21 '16 at 16:52

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


stat(1) can show many file associated attributes by specifying special format strings to it's -c option. In your case, use stat -c '%a' ~/.ssh/authorized_keys to receive the same file mode in octal, 600.

See it's manual page for a full list of supported format modifiers.

  • This is Linux-specific, mind you. *BSD systems also have a stat(1), but with different options. – Satō Katsura Jul 21 '16 at 15:58

Not the answer you're looking for? Browse other questions tagged or ask your own question.