1

When I SSH into my ubuntu server on EC2 in Amazon Web Services, and I change to the root user using sudo su, I navigte to /etc/apache2/sites-available to make changes to the 000-default.conf file there. This was working just fine, but when I nano in (using nano 000-default.conf), I am seeing just a blank page in the terminal.

When I do the same thing as just the ubuntu default user (not root), I see the file fine. This just changed after I made a change to the file as the root user. I can't make any more changes as the default user (it needs to be root for the permissions). Any idea why this is happening? Thank you.

  • Check the file ownership and permissions. – closetnoc Mar 23 '14 at 23:43
  • no matter what the permissions are you should always be able to edit a file as root. – phoops Mar 24 '14 at 8:41
  • Are you typing the file name wrong when using sudo? If I use sudo nano 0000-default.conf I get a blank screen (note the extra zero in the filename). – Stephen Ostermiller Jul 22 '14 at 19:38
  • See this post: Is there a difference between sudo su - root and sudo -u root -H /bin/bash? It has been my practice to never use both together as the shell can't keep track of the environment variables in some cases. – eyoung100 Jul 22 '14 at 20:08
  • So then another possibility is that your /root/.bash_profile or /root/.bashrc is changing the working directory. In that case you are not editing a file in the current directory anymore with sudo. Try with a full path to the file: sudo nano /etc/apache2/sites-available/000-default.conf – Stephen Ostermiller Jul 22 '14 at 20:16