I'm trying to modify files in the /root folder but I can't because I don't have permission.

I don't understand what is happening because i thought i'm logged in with the root but the name is just different.

I can't even add a new file, for example I'm trying to add a text file to the "www" folder to try and add a php file to run in Apache but i can't add a file.

However when i access the terminal and work with sudo it works fine but i want to do it the normal way.

The question here: how to grant my user full root privileges ? (Because i want to add and edit the "www" folder)

I'm supposed to be the root but my user directory is not in the root it is in the home directory :( What's wrong ?!!!

  • That is fully normal that you can not modify the files of other users. Root is not your regular user account, so you have to use the terminal and sudo. Btw.: What is special in the /root directory that you can only have you desired files there? – Manuel Jun 18 '13 at 5:57
  • the "www" folder to add php files :) – RAKuser Jun 18 '13 at 6:17
  • Why don't you create a user that runs the apache and use this www folder. – Manuel Jun 18 '13 at 6:23
  • Simply because i don't know :) ,,, how ? "I didn't understand" – RAKuser Jun 18 '13 at 6:24
  • Have you seen this guide – Manuel Jun 18 '13 at 6:31

I think what you are looking for is to use nautilus (that's the name of the default file manager in Ubuntu) as a root user. Although it is not advisable (especially for novice users), it is still possible to do it. Open up a terminal (Ctrl+Alt+T) and type

gksudo nautilus

Alternatively, you can type in the following lines in the terminal window

sudo su

Enter your password when it asks for it.

This allow you to run Nautilus with root privileges. So you can now freely edit your files using the GUI instead of the terminal. I still don't see the need for it and I cannot emphasize enough on the potential risks involved. Don't blame me if you break your system using this method. You have been warned!

| improve this answer | |

It's generally not a good idea to make your user have root privileges. If you need to perform some action that requires root privileges, you can request those privileges just for that particular command with sudo on the console, or kdesudo or gksudo if you're using KDE or Gnome/Unity, respectively.

| improve this answer | |
  • Yea i know i can do it with the sudo on the console but i'm a new user and i'm trying to do the work using the interface because i don't know how to operate via the terminal. Thanks – RAKuser Jun 18 '13 at 6:15
  • Use the console and type gksudo nautilus and that should give you an instance of the file manager that has root privileges. Be very careful, and close it as soon as you're done doing what you need root privileges for. You don't want to forget that your file manager has root privileges and do something stupid. – Jason Jun 18 '13 at 15:23

Becoming a user having full Root privileges is not considered a good way of working with Ubuntu (or even Linux in general).

There are a lot of important things that can be messed up if you operate as a root user. You could mess up with your Core OS files. Everything that needs to be done as a root user can be done by using the sudo command.

Also a small tip: Use symlinks to link files in the www folder with the files in your home folder to avoid managing file permissions.

| improve this answer | |
  • I tried to use the symlinks as you suggested to have a folder in my home directory linked to /var/www (notice i want to have full privileges on this folder to add php files). I still have the problem i can't add any files to it. Can you show me how to do it, maybe i'm doing something wrong. Thanks – RAKuser Jun 18 '13 at 6:11
  • Symbolic links don't change anything about permissions. The target of the link (the original file/folder) still needs to have regular permissions to allow the operation. Would be a very easy compromise of the server if that would work! – gertvdijk Jun 18 '13 at 6:52
  • Thanks @gertvdijk this is exactly what i noticed after i tried the symlinks. It is not a solution to my problem :( – RAKuser Jun 18 '13 at 7:01
  • @RAKuser do not mind but you are doing it the wrong way. Instead of creating a link in your home folder create a symlink in your /var/www folder by using the sudo command. Here is a sample to make it easy for you. sudo ln -s /home/RAKuser/website /var/www – Abhishek Kandoi Jun 19 '13 at 7:07
  • It didn't work -_- , I will just copy the files via the terminal in sudo mode to the "www" directory,,, Thanks – RAKuser Jun 19 '13 at 7:35

I have solved the problem by editing the permission on the folder by (chmod g+w www)&(chmod o+w www)... Thanks

Do you think this is an appropriate method ? or copying the 'php' files to the "www" directory from 'sudo' terminal is better ?

I got help from HERE

| improve this answer | |
  • Editing the permission on the folder www is not a good option. It can lead to security problems. Read my comment on my answer to see what the usual method for doing it is. – Abhishek Kandoi Jun 19 '13 at 7:11
  • Could you please give me an example to why editing the permissions will cause a problem ? Because i really can't see it, thanks – RAKuser Jun 19 '13 at 7:36
  • Modifying the permissions of the www folder will allow anyone with access to your computer/laptop to be able to modify your files as well as delete them. This can be a problem if your laptop/computer is used by someone else. – Abhishek Kandoi Jun 25 '13 at 11:20

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.