Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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.

share|improve this question
    
Check the file ownership and permissions. –  closetnoc Mar 23 at 23:43
    
no matter what the permissions are you should always be able to edit a file as root. –  edvinas.me Mar 24 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 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 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 at 20:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.