My Ubuntu vitual server wen't offline. I rebooted it and now want to debug what happened.

I can browse to /etc/log but if I try cd apache2 it says Permission denied. I'm sure my user account has priviliges. I also tried sudo cd apache2 which gives the the error sudo: cd: command not found

How can I access the apache logs? I also tried via sftp without success

PS I am new to linux and virtual servers, but I am keen to learn everything I can.

  • Try sudo -i then cd apache2. – Wilf Feb 16 '14 at 15:45
  • @Wilf it then says -bash: cd: apache2: No such file or directory – S.. Feb 16 '14 at 16:12
  • sudo su them access – vidur punj Aug 13 '17 at 12:22
up vote 22 down vote accepted

You need to add your username to the group adm

sudo usermod -aG adm YourUserName

You can then access the logfiles as normal user without sudo.

  • Thanks, this worked and made me able to actually browse to directory. – S.. Feb 16 '14 at 18:07
  • 12
    I had to log in / out of my user session for this permission to take effect. – Horba Jan 29 '15 at 0:15

Try:

sudo cat /var/log/apache2/error.log
  • Thanks wojox, but is there a more permanent solution? Like being able to navigate to the apache2 folder? – S.. Feb 16 '14 at 16:13

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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