0

Ubuntu newbie here. I succesfully installed Ubuntu on a VM on Windows. I am now trying to run a localhost website using nginx.

I have read tutorials online on how to create your website in /var/www and that you will have to create also these folders if they dont exist.

So at the terminal I did this because the /var/www-folder did indeed not exist on my system:

root@Ubuntu-VM:/home/reveller# mkdir /var/www

Later I realized that /var/www is actually an existing directory. I have been creating /home/user/reveller/var/www while /var/www/ was already there.

I am now trying to access /var/www/ via terminal, but in my terminal prompt I cannot seem to go to a lower level in the filestructure than /home/reveller.

Question:

Question 1: How can I launch a terminal with prompt root@Ubuntu-VM:/var/www# instead of root@Ubuntu-VM:/home/reveller#?

I hope I am making myself clear. I read about sudo but the following makes no difference:

root@Ubuntu-VM:/home/reveller# sudo su
root@Ubuntu-VM:/home/reveller# 

How do I traverse up the tree until I am in /var/?

Question 2 When I try to create new folders in /var/ via the GUI filebrowser, I am unable to -- the New Folder, New Document and Paste commands are greyed out and cannot be clicked. How can I open an elevated GUI filebrowser that allows me to create, copy and paste folders troughout the filestructure?

1

Changing your home directory

sudo usermod  -d /var/www  your_username

The reason that sudo su is not doing anything for you is because you are already the root user.

Traversing a directory

To traverse up a file tree, you have to use the cd command. So in your case, you would have to do cd /var/

| improve this answer | |
  • Thanks! In the terminal, i am now indeed able to browse to /var/ but if I am trying to copy the /www directory from my home folder to /var using cp -a /home/reveller/var/www/ /var/www/ (folder /var/www/ does not yet exist) I get an error: cp: cannot create directory ‘/var/www/’: Permission denied. User reveller is indeed root (by using whoami), so why is this not working and what can I do about it? – Pr0no Dec 13 '15 at 1:10
  • You have to be sudo by typing in sudo -i or sudo su either one will work fine. – Alex Lowe Dec 13 '15 at 1:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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