1

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 ?!!!

RAKuser
  • 11
  • 1
  • 6

4 Answers4

2

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
nautilus

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!

Anurag M
  • 121
1

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.

Jason
  • 163
  • 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 06: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
1

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.

  • 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 06: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 06: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 07: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 07: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 07:35
  • 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 07:37
0

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

RAKuser
  • 11
  • 1
  • 6
  • 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 07: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 07: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