I have Ubuntu 14.04 on two droplets. One was the one click LAMP install the other I installed Apache2 manually.
With both droplets the directory for the log files are set as:
drwxr-x— 2 root adm
When I try:
‘sudo cd /var/log/apache2’
I get the error: ‘sudo: cd: command not found’
The only way of moving into that directory is to log in as root. Sudo doesn’t work.
However, I can do: ‘sudo less /var/log/apache2/access.log’ and read the output.
Why isn’t ‘cd’ working with sudo in this instance?
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.