0

I have been trying to change the ownership of a folder from "root" to "caleb" (the user). When I attempt to change it in the terminal, it states that it has been changed, but when I look at the properties of that folder in Nautilus, it is still owned by root.

Terminal changes ownership

caleb@Caleb-Linux:~$ sudo chown caleb -v /opt
[sudo] password for caleb:
changed owndership of '/opt' from root to caleb

Output of ls -ld:

caleb@Caleb-Linux:~$ ls -ld /opt
ddrwxrwx--- 4 caleb caleb 4096 May 10 21:37 /opt

But Nautilus doesn't show ownership change

Nautilus doesn't show ownership change

xiota
  • 4,849
  • 1
    What appears when you do: ls -l – Adail Junior May 30 '18 at 20:00
  • I just tried it, and my file browser Nautilus wasn't showing the ownership change until I hit CRTL-R, which refreshed the root folder contents/info. Then the file browser showed the new ownership. – SunnyDaze May 30 '18 at 20:25
  • Why do you need to change the ownership of /opt why not change the ownership of a subfolder instead? – George Udosen May 30 '18 at 20:29
  • @GeorgeUdosen I use a lot of folders in /opt but i dont have ownership of /opt also I want access to it...why shouldnt i have access to it? – Otsubosan May 30 '18 at 20:36
  • Your ls -l listing doesn't show opt. You changed the ownership of the /opt directory itself. What does ls -ld /opt show? And, please, do not post raster screen captures of text! – Kaz May 30 '18 at 20:41
  • @Kaz it says "drwxrwx--- 4 caleb caleb 4096 May 10 21:37 /opt " – Otsubosan May 30 '18 at 20:46
  • The subfolders of /opt should have their ownership changed not the main /opt folder, remember that that folder is used by the system. – George Udosen May 30 '18 at 23:25

1 Answers1

1

Your command changes the permissions of the /opt directory, but not its contents. To verify that the ownership is changed, use:

ls -ld /opt

If you forget the -d, this will list the contents of /opt, not the /opt object itself.

If you want to change the ownership not only of /opt itself but everything it contains, you need the -r (recursive) option on chown.

As to the GUI not showing the updated ownership of /opt; that could just be from it not re-reading the filesystem and relying on previously scanned information.

On Ubuntu 17.10, I can easily reproduce what I think you're running into. When I open the root directory ("Computer") in Nautilus, and right click on "opt" then view the "Properties", it's owned by root. If I change the ownership to myself in the shell, then of course this window doesn't change. If I close the Properties window and then right click on "opt" again to view the properties, it still indicates that it's owned by root.

To get Nautilus to re-read the latest meta-data and show the up-to-date permissions, hit Ctrl-R to refresh. Or else navigate to another folder and back.

Kaz
  • 615