When you launched caja as a super user, did you do it with “sudo caja” or “gksudo caja”?
The reason I ask is because you should never use “sudo” to start graphical applications as Root. You should, instead, use “gksudo” to run such programs. gksudo sets HOME=~root, and copies .Xauthority to a tmp directory. This prevents files in your home directory becoming owned by Root.
In addition to @stevecook172001’s important suggestion there’s one biggy I learned over the years.
If you have both your user and root instances of Caja or Thunar running, everything pasted into the root instance will be owned by root. If you want it to be owned by your user, paste it into the user instance.
Also, many are unaware that if you need to edit a text file as root there’s a right-click option “Open as administrator” that can be very handy.
Just tried the following and it seems to work in that it allows caja to be opened as root with the correct file permissions, but without having to enter the gksudo gui password.
Disable the requirement for the sudo password for the user with the following addition to the sudoers file:
yourusername ALL=NOPASSWD: ALL
where “yourusername” should be replaced with your actual user-name (mine, for example, is “stephen”)
Create the following script:
sudo su <<EOF caja EOF
Then execute that script to open caja as root with the proper file permissions attached to root and not the user
Actually, I have just logged out and back in and it seems even that script is not necessary. gksudo caja (or any other file manager you prefer) opens straight to root without the need for a password