How to copy the permission of root to current user?

Copying things as root will make things become owned by root (gksudo I think is just to stop program settings etc becoming owned by root - see here) - you should be able to fix it using the following :

sudo chown -R $USER:$USER /<PATH>/<TO>/<COPIED>/<FOLDER>

It:

  • Uses chown
  • -R recursively modifies directories and files
  • $USER is replaced with your username by the shell (command line, bash etc), so it tells it to make the files' and folders' user and group IDs your user's.
  • Carries it out on the specified path - e.g./<PATH>/<TO>/<COPIED>/<FOLDER>. Do not do it on just /, /usr etc, as it probably will break the system.

For example:

$ touch file
$ sudo cp file filert
$ ls -l | grep file
-rw-rw-r--.  1 wilf wilf         0 Jul  2 09:42 file
-rw-r--r--.  1 root root         0 Jul  2 09:43 filert

The above commands. create a file called file, copy it as root to filert, then displays the file properties. When files are copied as root, the resulting file should be owned by root - this is what happened to your files. With the above example, filert can be made usable by a normal user using:

$ sudo chown $USER:$USER filert 
$ ls -l | grep file
-rw-rw-r--.  1 wilf wilf         0 Jul  2 09:42 file
-rw-r--r--.  1 wilf wilf         0 Jul  2 09:43 filert