By Brohemian
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?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
The sudo command works only for executables and cd is a shell builtin.
You can use sudo -s to move to a root shell and execute cd or do sudo ls /var/log/apache2 and then view the file of your choice.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.