3

For some reason an Ubuntu server (14.04.4 LTS) I'm working on will not allow "man" to be run by regular user. Example:

man ls
man: can't change directory to '/root': Permission denied
man: command exited with status 255: (cd /root && LESS=-ix8RmPm Manual page ls(1) ?ltline %lt?L/%L.:byte %bB?s/%s..?e (END):?pB %pB\%.. (press h for help or q to quit)$PM Manual page ls(1) ?ltline %lt?L/%L.:byte %bB?s/%s..?e (END):?pB %pB\%.. (press h for help or q to quit)$ MAN_PN=ls(1) pager -s)

How might this have happened and more importantly how can I fix it?

UPDATE:

Seems this only occurs after I su user where "user" is a non privileged user. Workaround is to su -l user but I still don't understand why man would become a privileged command without the login flag.

6
  • Whats the output of type -a man?
    – heemayl
    Jul 28, 2016 at 20:27
  • @heemayl man is /usr/bin/man Jul 28, 2016 at 20:27
  • Whats the output of echo $MANPATH?
    – heemayl
    Jul 28, 2016 at 20:30
  • @heemayl - no output for that (an empty string) Jul 28, 2016 at 20:32
  • What about echo $MANPAGER and echo $PAGER (when su'd to user)? Jul 28, 2016 at 20:51

1 Answer 1

1

You are currently in the folder /root.

man runs some command including cd <current folder>. In this case that is cd /root (compare the 2nd line of the error). But that is not allowed for non-root user.

The following will work:

cd ~ && man ls

To reproduce the same behaviour you can do this:

$ sudo su
# cd /root
# su normal_user
$ man ls
man: can't change directory to '/root': Permission denied
2
  • thanks. any idea why man is doing cd .? What would be the point of that? May 16, 2017 at 15:22
  • i have no clue, sorry.
    – pLumo
    May 17, 2017 at 5:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .