# Strace is throwing permission denied error

## unixbhaskar

Here what I got :

```

root@bhaskar-laptop_10:40:35_Wed Sep 15:/ # strace /dev/zero

execve("/dev/zero", ["/dev/zero"], [/* 22 vars */]) = -1 EACCES ([b]Permission denied)[/b]

dup(2)                                  = 3

fcntl64(3, F_GETFL)                     = 0x2 (flags O_RDWR)

fstat64(3, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 2), ...}) = 0

mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7705000

_llseek(3, 0, 0xbffa6050, SEEK_CUR)     = -1 ESPIPE (Illegal seek)

write(3, "[b]strace: exec: Permission denied\n", 32strace: exec: Permission denied[/b]

) = 32

close(3)                                = 0

munmap(0xb7705000, 4096)                = 0

exit_group(1)                           = ?

```

Why this is happening?? 

Here is my mounts where the binary reside:

```

/dev/sda1 on / type ext3 (rw,relatime,errors=continue,barrier=0,data=writeback)

```

Please throw some light on it.   :Sad: 

----------

## mikegpitt

Does the permissions denied only happen when you run `strace /dev/zero` or all the time?  The reason you are receiving it in the /dev/zero example is because you can't execute /dev/zero.  I get the same permissions denied on my machine as well.

```
$ ls -ltr /dev/zero 

crw-rw-rw- 1 root root 1, 5 Sep 14 06:24 /dev/zero

```

```
$ strace /dev/zero 

execve("/dev/zero", ["/dev/zero"], [/* 52 vars */]) = -1 EACCES (Permission denied)

dup(2)                                  = 3

fcntl64(3, F_GETFL)                     = 0x2 (flags O_RDWR)

fstat64(3, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 4), ...}) = 0

mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7848000

_llseek(3, 0, 0xbff8b188, SEEK_CUR)     = -1 ESPIPE (Illegal seek)

write(3, "strace: exec: Permission denied\n", 32strace: exec: Permission denied

) = 32

close(3)                                = 0

munmap(0xb7848000, 4096)                = 0

exit_group(1)                           = ?

```

----------

## unixbhaskar

Sorry my mistake... I have got the desired result as I was trying to read from /dev/zero file ..so missed the cat in the command line will cause that error.Plus you can investigate with strace with any file not only with the executables.

Cheers mate!   :Smile: 

----------

