Posted 2019-11-21 with tags stat, linux, linux utilities, permissions

In this example, let's inspect the permissions of the authorized_keys file with the ls command:

ls -lah ~/.ssh/authorized_keys 
-rw------- 1 void void 1.3K Apr  6  1998 /home/void/.ssh/authorized_keys

We see that the current permissions for the file are: -rw-------, and if we want to know what that translates to in octal form (an easy form to use when setting permissions using the chmod command), we can inspect the file with stat:

stat -c "%a %n" ~/.ssh/authorized_keys
600 /home/void/.ssh/authorized_keys