Saturday, May 4, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 1256  / 3 Years ago, wed, october 13, 2021, 6:18:54

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.



Jorge.


More From » permissions

 Answers
2

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.



salú!


[#27415] Wednesday, October 13, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tinchir

Total Points: 300
Total Questions: 116
Total Answers: 119

Location: American Samoa
Member since Sun, Jan 17, 2021
3 Years ago
tinchir questions
Tue, Sep 14, 21, 23:11, 3 Years ago
Mon, Dec 19, 22, 13:00, 1 Year ago
Sat, Feb 5, 22, 11:36, 2 Years ago
Mon, Aug 8, 22, 02:16, 2 Years ago
;