How do I access the file system as a root or owner?
Solution 1
By default /var/www
is owned by root:root and no one but the admin can add or change files there. You need to set contents of /var/www/
to the correct permissions. There are several methods but the one I use: set the group to www-data
and add your user to that group.
Setting group www-data
:
sudo chgrp -R www-data /var/www/ubuntu
Add your user to www-data
:
sudo usermod -a -G www-data $USER
That way you are part of the group that can write inside /var/www/
.
But I would start by reading the documentation that you got with the webserver since this is just a small part in setting the correct and secure permissions. Directories tend to have permissions set to 755
or 775
and files to 644
or 664
depending on who you want to be able to do things.
Solution 2
Try sudo -s
command in terminal. But make sure you know what you’re doing.
Also, if you don’t want to mess with terminal, you can press ALT+F2 and enter gksu nautilus
. This will open a file manager window from root user.
Related videos on Youtube
Shry Vishnu Murugesan
Updated on September 18, 2022Comments
-
Shry Vishnu Murugesan over 1 year
I need to add online store configuration files in file system
var/www
. but I can't access the file system, because it says that only owner can access it, the owner isroot
.So, how can I access those files? Or is it possible for me to use my file system as a owner?
I need to create a directory named
ubuntu
invar/www
and store my online store configuration files. -
Wuron over 11 yearsAlso, if you don’t want to mess with terminal, you can press
ALT+F2
and entergksu nautilus
. This will open a file manager window from root user. -
Shry Vishnu Murugesan over 11 yearsand may I know what should I do next?? as I am new to ubuntu it would be grt if you explain me in detail!!
-
guntbert over 11 years@AleksandrChepurnoy please put that part from your comment into your answer.
-
Rinzwind over 11 yearsI would not assume that he has a desktop ;) This sounds more like a (hosted) server.
-
David Foerster over 9 yearsIf I remember correctly, new user groups are only applied to new sessions, so after calling
usermod
, you need to log out and back in. -
Rinzwind over 9 years@DavidFoerster yes it is required to update the desktop settings. Not for a shell ("newgrp" can be used to update a new shell for the time being)