34

I had a bad habit of storing my wallpapers in /usr/share/backgrounds, and decided to move them all into Pictures. Well, the problem is that most of them are now read-only since they are owned by root. How can I become the owner of them, if root already owns them? I have already tried How can I become the owner of a file that origins from another pc / user?, but the settings do not "stick".

enter image description here

65
  1. Open a terminal (CTRL+ALT+T). Now you are in your home.
  2. sudo chown -R $USER:$USER Pictures and type your normal user password.
2
  • 1
    Or if another directory in your home folder substitute that for pictures. Worked for me and the subfolders as well. – lewis Nov 14 '18 at 17:26
  • the -R or –recursive option to operate on files and directories recursively – Yevgeniy Afanasyev Nov 30 '18 at 0:48
12

You can do it via terminal or gui.

GUI VERSION

Press ALT+F2 and type gksu nautilus This will turn you into an admin account using nautilus. Now go to those files and change the permissions/owner so your normal account can use them. This sometimes not work. At least for me they work and in another PC do not. Test and see.

The GUI version looks almost the same as Dash, except that instead of saying "Search" in the search bar it says "Run a command". Here is an image:

enter image description here

TERMINAL VERSION

Type ALT+F2 and type gnome-terminal. Go to that folder. In your case it would be cd "/home/alan/Desktop/Untitled Folder" and type sudo chown alan:alan *.jpg. This will work because it will ;)

3
  • Thanks CYREX! The GUI version would never work for some reason, but running that in Terminal did the trick. Vanni was the first to answer (by 6 seconds), but I since you both had practically the same answer I up-voted yours too :) – Alan May 6 '11 at 22:11
  • @Luis The GUI version work on any Ubuntu's version or only for the 12.04? – Lucio Aug 18 '12 at 22:12
  • 1
    @Lucio - I can confirm it works at least since 11.04. I tried that in 11.04, 11.10 and 12.04. – Luis Alvarado Aug 19 '12 at 0:42
6
sudo su
chown user_name folder_name

First Open your super user which is root

In the above Command user_name is the name of user on which you want to set the ownership folder_name is the folder which ownership you want to change

1
  • 5
    There is no need to do sudo su at all if you are already doing sudo chown. – edwinksl Jul 27 '16 at 6:36
2

Command line: use Alt+F2

Change to the directory that contain your files that you want changing. Use sudo in front of your command that changes permissions, the owner and group of those files. You will be asked for your password and the command will execute as if you are root.

You could also do sudo su to enter root.

$ sudo su
[sudo] password for {username}: 
root@{host}:/home/{username}#

Then change to the directory that contain your files that you want changing.

Permission are changed with chmod Example: chmod 755 somefile would make it read, write, execute for your as the owner and read, execute for group and others. User and group are changed with chown Example: chown alan:alan somefile would make alan owner of somefile.

edit: after reading the link you posted I have a question! Did that topic not already answer your question? It talks about executing gksu nautilus. This option lets you use Nautilus as a root user. That would allow you to change access (see the picture in that topic).

3
  • Hi Rinzwind, thanks for your answer! As always I searched for the question before I posted mine, and ran across that one. It said to use gksu nautilus which was the first thing I tried prior to finding that question. But for some reason, I would change the permissions, and they would always reset, even as root. Weird! – Alan May 6 '11 at 22:14
  • Not weird! plain stupid ;) Might be a bug :X – Rinzwind May 6 '11 at 22:15
  • I sure hope not! Either which way, I've stopped putting my wallpapers there, makes sense not to. – Alan May 6 '11 at 22:17

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.