Copying one file to another folder

hello everyone, I wanted to know how would i move or copy a image file to another folder

I’m trying to add a few more backgrounds to the following folder below

usr share backgrounds

But when ever I try it will not allow me to move the files into the desired folders

It tells me I do not have permission

Thanks so much for any help

Open your file manager with superuser permissions. gksudo caja

edit: Use the Terminal to enter “gksudo caja”

I usually right click the locked folder, open as admin, (password prompt will appear) wait for the new window to open then move your files into that directory.

Open a terminal and type

sudo caja

Or, navigate to any folder using standard Caja and right click the folder and select “open as administrator”

Either of the above two methods opens Caja as a root user. Having once opened root Caja, you can then navigate anywhere on your system with it and you can copy and paste any file from and to anywhere on your system. Obviously, take care when using Caja as a root user, since it allows you to accidentally break your system if you delete the wrong files.

Don't you mean gksudo

No I always use sudo. As far as I am aware, gksudo brings up a GUI for the password. But sudo merely requires you enter the password in the terminal.

Also, sudo caja brings up the following:

Whereas gksudo caja brings up the following:

I find the first of the above more useful since it opens up directly into my home folder, which is where I usually want to be to copy a file or folders from my home folder to elsewhere on the system

Have I got that wrong?

3 Likes

Thanks Stephen, I learned something new today.

1 Like

As @stevecook172001 pointed out, the following command makes you superuser but not root:

sudo caja

Whereas the folowing command will make you root:

gksudo caja

Sudo vs gksudo is well documented Steve. The link I posted above uses the word never, but I have found one exception by using the "H" switch.

-H, --set-home
Request that the security policy set the HOME environment
variable to the home directory specified by the target user's
password database entry. Depending on the policy, this may
be the default behavior.

In terminal:

man sudo

Thanks guys for all the help, what I was doing wrong is whenever I wanted to access my files I always open up the Home folder, obviously I’ve learned something new today and will apply this method each time I want to move or copy, my files

I’m assuming Caja installed by default with Mate?

Big thanks to you all

3 Likes

Hi @Robgoss,

yes!, Caja is installed by default in Ubuntu Mate as it is the default file manager for the Mate desktop. :smiley:

The only “advantage” of opening with gksudo caja, though, is that it opens directly in the root home folder. As compared to opening with sudo caja, where it opens directly in the user’s home folder as a super user. From that point onward, the permissions are identical are they not? I have just tested this and both methods allow write access in both a standard user’s home folder as well as the root home folder and they both allow full write access to the rest of the system.

All of the above being the case, sudo caja is more efficient in most cases because any files that may be required to be copied to some system folder (themes or icons for example) will have been initially downloaded to a users home folder - not the root home folder. Thus, sudo caja opens up right inside that user’s home folder.

Unless I am missing something?

Hi Steve,

there is a very slight difference in the user elevation of the commands and you are right about both commands doing more or less the same thing, the “gksudo caja” command gives you overall access within Caja directly as “root” and that’s it really!. :smiley:

I have just used sudo caja and it gives full write access to the root home folder. In which case, gksudo caja is not required to gain root home folder write access. It’s only advantage appears to be that it opens directly inside the root home folder as opposed to the user’s home folder. But that’s it. And, for 99% of usage, surely that is not an “advantage”. It is a disadvantage, in terms of efficiency. Unless I am missing something? I am more than happy to accept I am, but I need it explaining to me.

HI Steve,

Difference Between gksu And gksudo In Ubuntu gksu and gksudo perform the same task as they are symbolically linked. (they both point to the same executable).You should however assume that gksu is the graphical equivalent of the su command which means you have switched to the environment of the user. The gksudo command is equivalent to the sudo command which means you are running the application as the person you are impersonating which by default is root.

Info taken from here:

https://www.lifewire.com/what-is-gksu-2189402

So does that mean they are functionally identical in terms of write permissions? It seems to be saying that. If it is, then I stand by my initial assertion that sudo caja is more efficient simply because its opening position is inside the user’s own home folder as opposed to the root home folder

The only documentation I find supports the use of gksudo or gksu for use with a GUI. Can you point us to any doc’s/links that support the use of just sudo with a GUI? I would need to read this.

My assertion is not based on any documentation. It is based on my own experience of using both methods. There is, in my experience no difference whatsoever in terms of the write permissions. The only difference, so far as I can see, is that sudo caja opens in the user’s home folder whereas gksudo caja opens in the root home folder. And that’s the only difference. But it is a relevant difference in terms of efficiency of usage since most files that most users are going to want to copy over to the system will have been initially downloaded into their own home folder. Hence my use of sudo caja as opposed to gksudo caja.

However, as I have repeatedly said, I am more than happy to modify my opinion on this if someone will point out what the functional difference is in terms of elevated permissions. Wolfman has mentioned elevated permission being slightly higher with gksudo caja as opposed to sudo caja. Okay - great. Can someone please tell me what those extra permission are? In which case I will change my opinion immediately.

As it is, I am still not aware of what those elevated permissions (as compared to sudo caja) are or, indeed if they exist. Also, I have read the documentation linked to up-thread and it seems to reiterate what I have said. That is to say, gksudo caja opens as root and sudo caja opens as superuser with functionally identical permissions to gksudo caja. In other words, there is nothing to choose between them in terms of elevated permissions. Which leaves only the issue of efficiency of usage. Which, for me and, I suspect, the vast majority of users the vast majority of the time, will tend to favour the use of sudo caja because it opens directly in the user’s home folder as opposed to the root home folder.

But, to repeat, if someone points out to me exactly what elevated permissions gksudo caja has that sudo caja does not and that these elevated permissions are relevant to the majority of usage or, to put it another way, what particular dangers are present with using sudo caja that are not present with using gksudo caja, I will happily change my position on this immediately

Okay I have found out the following:

It appears it is to do with the creation of cofig files. If using sudo caja, the config any automatically generated config file that occurs during the use of a graphical application could ened up being owened by root but in the user's home fodler instead of the root home folder. and this can potentially break a graphical application.

Please note that this is primarily about configuration files. If you run Nautilus as root, even with gksu/gksudo, and you create a file or folder anywhere with it (including in your home directory), that file or folder will be owned by root. But if you run Nautilus (or most other graphical applications) as root with sudo, they may save their configuration files in your home directory (rather than root's home directory). Those configuration files may be owned by root and inaccessible when you're not running as root, which can severely mess up your settings, and may even keep some applications from working altogether.

In other words, the elevated permissions are the same. But the dangers are different.

So, on that basis, I will amended what I have said thus far with the following:

On the basis of the above, I cannot recommend to others the use of sudo caja. For myself, since I have used it for ages, with no ill effects whatsoever, I will probably continue to do so. On the other hand, I may simply make a panel launcher with:

gksudo caja /home/stephen

2 Likes

Thanks so much for the info I think we can consider this solved

2 Likes