An app (Autokey-qt) installed itself with root as owner. It spans a lot of files and directories. I need to change the ownership to me in order to be able to edit the macros and configuration files. I'm going one by one by checking their name and location with Nautilus search but it's taking forever.

Is there a way to make chown to execute a change of owner to all files and dirs in the disk from root to me?

Right now as I locate them I copy the path from the file properties dialog and then do a sudo chown -hvR jorge /<file path>/autokey.

I want to believe there's a switch to find and chown every file and dir with autokey on its name (autokey might be part of the name or be capitalized) or even within the contents of the file (a python scrip for example).

Thanks for any help.


  • How did you install Autokey? – kiri Jan 18 '14 at 6:58

i'd uninstall and install again correctly, there may be other issues related that you are yet to run into.

if you want to change ownership of all files within the path /home/someuser/somedir/app/ with the pattern autokey in their name (case insensitive. case sensitive would be -name rather than iname) to user called myuser i'd do:

find /home/someuser/somedir/app -iname *autokey* | xargs -I '{}' sudo chown -hvR myuser '{}'

example using rela as user and /tmp/test as path:

rela@rela-x230:/tmp/test$ tree .
├── 1
│   └── 2
│       └── tetasAutokey.algo
└── 2
    └── otronombreautOkey.otracosa
3 directories, 2 files
rela@rela-x230:/tmp/test$ find /tmp/test -iname *autokey* | xargs -I '{}' ls -l '{}'
-rw-r--r-- 1 root audio 0 Jan 17 21:59 /tmp/test/2/otronombreautOkey.otracosa
-rw-r--r-- 1 root audio 0 Jan 17 21:59 /tmp/test/1/2/tetasAutokey.algo
rela@rela-x230:/tmp/test$ find /tmp/test -iname *autokey* | xargs -I '{}' sudo chown -hvR rela '{}' 
changed ownership of `/tmp/test/2/otronombreautOkey.otracosa' from root to rela
changed ownership of `/tmp/test/1/2/tetasAutokey.algo' from root to rela
rela@rela-x230:/tmp/test$ find /tmp/test -iname *autokey* | xargs -I '{}' ls -l '{}'
-rw-r--r-- 1 rela audio 0 Jan 17 21:59 /tmp/test/2/otronombreautOkey.otracosa
-rw-r--r-- 1 rela audio 0 Jan 17 21:59 /tmp/test/1/2/tetasAutokey.algo

hope this helps.


  • Certainly helps. Many thanks! I must learn Ubuntu's command syntax well. Your answer commes real handy for a number of rutinary chores. In any case, the reinstall route sounds like the better alternative. Nothing lost by starting afresh. Can you refresh me the syntax to purge any leftovers after an uninstall via terminal? Would you believe that 20-odd years ago I used to be a real DOS wizard who made astounding batch files and coded in xBase easily? Now I can even scratch the new languages like Visual C ur Python. Even .sh files mistify me. I must start studying again... =( – Jorge M. Treviño Jan 18 '14 at 22:55

Please do not change permissions of files installed by any application!

By design all applications will be installed by root in Ubuntu. This is one of the major security features we have to prevent our system from malware and accidental file removal.

Application binaries have their defined location in the filesystem as was specified in the DEBIAN package. For any Debian related distribution we have a Filesystem Hierarchy Standard to help maintaining the system. Applications must meed this standard to be included in a distribution.

Whenever an application needs user setting they will be stored in a separate directory on your HOME directory (ususally in a hidden dot file in ~/.config/<app_name>/, or ~/.appname/).

In the rare case we need to change system-wide application settings we need to do that with root privileges which can be reached by using sudo.

Running the chown command recursively as root bears a great risk to break your system. If any possible avoid doing that.

See also related questions:

  • OK, thanks for the heads-up on that. I didn't intend to do that globally in any case but just to the Autokey files. Now I need the syntax to get back ownership of all Autokey files under ~/. Is that possible? I've isolated the problem to a lockup of the config and macro files. – Jorge M. Treviño Jan 18 '14 at 22:45

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.