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.
/opt
why not change the ownership of a subfolder instead? – George Udosen May 30 '18 at 20:29ls -l
listing doesn't show opt. You changed the ownership of the/opt
directory itself. What doesls -ld /opt
show? And, please, do not post raster screen captures of text! – Kaz May 30 '18 at 20:41/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