Is there a way to check the permissions of the root folder, /? I mean the folder's permissions, not its content's (/var, /usr, etc.) permissions? Running ls /.. shows the content's permissions.
3 Answers
You can also use the -d switch of ls:
$ ls -ld /
drwxr-xr-x 28 root root 126976 Mar 20 17:11 /
From man ls:
-l use a long listing format
-d, --directory
list directory entries instead of contents, and do not derefer‐
ence symbolic links
stat -c "%a %n" /
It will give you the permissions.
-
1Thanks, that was fast.
statseems like an interesting, useful command, having read itsmanpage.trysis– trysis2014-03-25 01:02:48 +00:00Commented Mar 25, 2014 at 1:02 -
You should use the
aswitch to see the permissions of.which corresponds to root home.Ramesh– Ramesh2014-03-25 01:05:22 +00:00Commented Mar 25, 2014 at 1:05 -
Yeah, that's what the other answer says, and what I should have thought of. D'oh!trysis– trysis2014-03-25 01:15:27 +00:00Commented Mar 25, 2014 at 1:15
-
ha ha. You can accept either of the 2 answers. Both the answers seem to suit what you need :)Ramesh– Ramesh2014-03-25 01:18:16 +00:00Commented Mar 25, 2014 at 1:18
-
Ugh, I wish I could accept both. They're both perfect!trysis– trysis2014-03-25 01:19:02 +00:00Commented Mar 25, 2014 at 1:19
Use the -a switch of ls to include hidden files as well as . and .. in the listing and the -l switch for a "long" listing (which includes the permissions, among other information):
ls -la /
The line with a single . in the last column will contain information about the listed directory itself, i.e. /:
drwxr-xr-x 26 root root 4096 Mar 10 15:57 .
However if you only need information about / itself, terdon's answer (using the -d switch) will probably be handier.
-
1@trysis I routinely use
ls -blah. It has everything you could possibly want to know about a file or directory.n.st– n.st2014-03-25 01:06:10 +00:00Commented Mar 25, 2014 at 1:06 -
2This is not really a very good solution, it will list all files under
/when all the OP wanted was/itself. Seestatorls -ldin the answers below.2014-03-25 02:08:25 +00:00Commented Mar 25, 2014 at 2:08 -
1@trysis You might want to accept terdon's answer instead since it's closer to what you originally wanted to achieve.n.st– n.st2014-03-25 03:14:09 +00:00Commented Mar 25, 2014 at 3:14
-
1Fair enough, the comment was not so much directed at you as to future users who might see this as the accepted answer and assume it is the Best Way® to do it.2014-03-25 03:15:57 +00:00Commented Mar 25, 2014 at 3:15
-
2
.is not necessarily first. The list is sorted lexically. There are several characters that sort before.in many locales.Stéphane Chazelas– Stéphane Chazelas2014-03-25 12:12:04 +00:00Commented Mar 25, 2014 at 12:12
-loption:ls -l //rootfolder permissions, which also does not make sense. I'll be damned if I do, damned if I don't.