[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Determining key permission bits
On 2013-12-20, at 12:13 AM, Andy Lutomirski <luto@amacapital.net> wrote:
> Is there any easy way to tell which permission bits a key file has?
Perhaps I’ve misunderstood your question, but
ls -l path/to/keyfile
E.g:
$ ls -l /root/kreacher-tarsnap.key
-rw------- 1 root wheel 4929 Nov 5 15:22 /root/kreacher-tarsnap.key
is how many people look to see what permissions are on a file
If you just want the numeric (octal) value, you can use stat.
On FreeBSD and OS X
stat -f %p path/to/file
E.g.:
$ stat -f %p /root/kreacher-tarsnap.key
100600
will get you that. On Linux (debian) it appears to be
stat -c %a path/to/file
If ACLs are set, then the following depends on Unix flavor:
FreeBSD (and probably others):
getfacl path/to/keyfile
E.g.:
$ getfacl /root/kreacher-tarsnap.key
# file: /root/kreacher-tarsnap.key
# owner: root
# group: wheel
user::rw-
group::---
other::---
OS X (and probably others)
ls -le path/to/keyfile
Anyway, I hope that somewhere in there is the answer to your specific needs. If not, please try to clarify the question a bit more.
Cheers,
-j