# [emacs] Listing directory failed but ‘access-file’ worked



## balanga (May 4, 2021)

When in emacs' dired and I select /mnt I'm refused access. I running as root, here are the permissions for /mnt

```
drwxr-xr-x   14 root  wheel          512 May  4 19:56 mnt
```
Does anyone know what emacs is objecting to? I have no problems with mc traversing the file system.


----------



## balanga (May 5, 2021)

Came across this post on Reddit which seems to suggest that it is due to a non-GNU version of `ls` which I suppose would apply to FreeBSD's ls(), but it does make any sense to me.


----------



## twschulz (May 5, 2021)

You need to install FSF coreutils (sysutils/coreutils) which will have give you GNU ls.

Then, in my emacs configuration I have this:


```
(cond ((eq system-type 'berkeley-unix)
          (setq insert-directory-program "/usr/local/bin/gls")))
```

Hope this helps!


----------



## balanga (May 5, 2021)

Many thanks that worked. I put this right at the beginning of my init.el. Just  getting started with emacs and scared of messing it up. I originally started looking at it a few years ago and installed a package called prelude although didn't have time to find my way around it or not. Not sure if it needs updating or not or where I got it from.


----------

