Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I just performed a fresh ubuntu install and i am seeing the following in lsof:

userA@az1:~$ lsof
COMMAND    PID  TID       USER   FD      TYPE DEVICE SIZE/OFF     NODE NAME
init         1            root  cwd   unknown                          /proc/1/cwd  (readlink: Permission denied)
init         1            root  rtd   unknown                          /proc/1/root (readlink: Permission denied)
init         1            root  txt   unknown                          /proc/1/exe (readlink: Permission denied)
init         1            root NOFD                                    /proc/1/fd (opendir: Permission denied)
kthreadd     2            root  cwd   unknown                          /proc/2/cwd (readlink: Permission denied)
kthreadd     2            root  rtd   unknown                          /proc/2/root (readlink: Permission denied)
kthreadd     2            root  txt   unknown                          /proc/2/exe (readlink: Permission denied)
kthreadd     2            root NOFD                                    /proc/2/fd (opendir: Permission denied)

Is this normal? If not how do I fix it? Trying to search for this particular error has lead me nowhere.

I am concerned that something is wrong because root is getting Permission denied errors.

ls -la result for the proc folder: dr-xr-xr-x 145 root root 0 Jan 13 17:33 proc

ls -la results for contents are: dr-xr-xr-x 9 root root 0 Jan 13 17:34 1

and for the contents of process 1.

sudo ls -la /proc/1/
total 0
dr-xr-xr-x   9 root root 0 Jan 13 17:34 .
dr-xr-xr-x 145 root root 0 Jan 13 17:33 ..
dr-xr-xr-x   2 root root 0 Jan 13 17:42 attr
-rw-r--r--   1 root root 0 Jan 13 17:42 autogroup
-r--------   1 root root 0 Jan 13 17:42 auxv
-r--r--r--   1 root root 0 Jan 13 17:34 cgroup
--w-------   1 root root 0 Jan 13 17:42 clear_refs
-r--r--r--   1 root root 0 Jan 13 17:34 cmdline
-rw-r--r--   1 root root 0 Jan 13 17:42 comm
-rw-r--r--   1 root root 0 Jan 13 17:42 coredump_filter
-r--r--r--   1 root root 0 Jan 13 17:42 cpuset
lrwxrwxrwx   1 root root 0 Jan 13 17:35 cwd
-r--------   1 root root 0 Jan 13 17:35 environ
lrwxrwxrwx   1 root root 0 Jan 13 17:34 exe
dr-x------   2 root root 0 Jan 13 17:35 fd
dr-x------   2 root root 0 Jan 13 17:42 fdinfo
-r--------   1 root root 0 Jan 13 17:42 io
-r--r--r--   1 root root 0 Jan 13 17:42 latency
-r--r--r--   1 root root 0 Jan 13 17:35 limits
-rw-r--r--   1 root root 0 Jan 13 17:42 loginuid
dr-x------   2 root root 0 Jan 13 17:42 map_files
-r--r--r--   1 root root 0 Jan 13 17:35 maps
-rw-------   1 root root 0 Jan 13 17:42 mem
-r--r--r--   1 root root 0 Jan 13 17:42 mountinfo
-r--r--r--   1 root root 0 Jan 13 17:42 mounts
-r--------   1 root root 0 Jan 13 17:42 mountstats
dr-xr-xr-x   5 root root 0 Jan 13 17:42 net
dr-x--x--x   2 root root 0 Jan 13 17:42 ns
-r--r--r--   1 root root 0 Jan 13 17:42 numa_maps
-rw-r--r--   1 root root 0 Jan 13 17:42 oom_adj
-r--r--r--   1 root root 0 Jan 13 17:42 oom_score
-rw-r--r--   1 root root 0 Jan 13 17:42 oom_score_adj
-r--r--r--   1 root root 0 Jan 13 17:42 pagemap
-r--r--r--   1 root root 0 Jan 13 17:42 personality
lrwxrwxrwx   1 root root 0 Jan 13 17:35 root
-rw-r--r--   1 root root 0 Jan 13 17:42 sched
-r--r--r--   1 root root 0 Jan 13 17:42 schedstat
-r--r--r--   1 root root 0 Jan 13 17:42 sessionid
-r--r--r--   1 root root 0 Jan 13 17:42 smaps
-r--r--r--   1 root root 0 Jan 13 17:42 stack
-r--r--r--   1 root root 0 Jan 13 17:35 stat
-r--r--r--   1 root root 0 Jan 13 17:42 statm
-r--r--r--   1 root root 0 Jan 13 17:35 status
-r--r--r--   1 root root 0 Jan 13 17:42 syscall
dr-xr-xr-x   3 root root 0 Jan 13 17:35 task
-r--r--r--   1 root root 0 Jan 13 17:42 timers
-r--r--r--   1 root root 0 Jan 13 17:42 wchan    
share|improve this question

migrated from serverfault.com Jan 13 at 22:52

This question came from our site for professional system and network administrators.

1 Answer 1

up vote 1 down vote accepted

It appears that you did not run lsof as root, given that you show a prompt with $. Run sudo lsof to execute the lsof command as root.

Some information about a process, such as its current directory (pwd), its root directory (root), the location of its executable (exe) and its file descriptors (fd) can only be viewed by the user running the process (or root). That's normal behavior. Sometimes the permission to access files in /proc doesn't match the permission in the directory entries, it's finer-grained (for example, it depends on processes' effective UID as well as real UID).

You might get “permission denied” as root in some unusual circumstances, when you're root only in a namespace. If you just installed a new machine, you won't be seeing this.

share|improve this answer
    
Ah thanks for the info! –  A Smith Jan 15 at 1:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.