Change Folder & File Permissions for all Subdirectories
I created some files as root that I would now like to be changed to a specific user. How would I do this? I cannot go trough the files one by one as that'd just take way too much time. I would like to do this preferably trough Nautilus. If there is an easier way to do it trough console though, I'm all in.
Solution 1:
I'm not aware of any way you can do this in nautilus but you can do it from a command line
For example I have the following files in a directory
$ ls -la
total 400
drwxrwxr-x 2 warren warren 4096 Jun 22 17:49 .
drwxr-xr-x 74 warren warren 20480 Sep 21 13:05 ..
-rwxrwxr-x 1 root root 199 Jun 22 18:02 ex1.py
-rwxrwxr-x 1 root root 43 Jun 22 17:45 hello.py
-rw-rw-r-- 1 root root 27792 May 27 15:18 img.txt
-rw-rw-r-- 1 root root 323944 May 27 15:16 img.xcf
-rwxrwxr-x 1 root root 3178 Jun 7 22:11 snake.py
-rw-rw-r-- 1 root root 3182 Jun 4 20:20 snake.py~
-rwxrwxr-x 1 root root 7242 May 27 09:26 test
-rw-rw-r-- 1 root root 821 May 27 09:25 test.c
You can change all these to be owned by the user warren with:
sudo chown -R warren:warren *
As shown
warren@dell:~/test$ sudo chown warren:warren *
warren@dell:~/test$ ls -la
total 400
drwxrwxr-x 2 warren warren 4096 Jun 22 17:49 .
drwxr-xr-x 74 warren warren 20480 Sep 21 13:05 ..
-rwxrwxr-x 1 warren warren 199 Jun 22 18:02 ex1.py
-rwxrwxr-x 1 warren warren 43 Jun 22 17:45 hello.py
-rw-rw-r-- 1 warren warren 27792 May 27 15:18 img.txt
-rw-rw-r-- 1 warren warren 323944 May 27 15:16 img.xcf
-rwxrwxr-x 1 warren warren 3178 Jun 7 22:11 snake.py
-rw-rw-r-- 1 warren warren 3182 Jun 4 20:20 snake.py~
-rwxrwxr-x 1 warren warren 7242 May 27 09:26 test
-rw-rw-r-- 1 warren warren 821 May 27 09:25 test.c
the -R
option means recursive; i.e. including sub-directories for more information enter man chown
in a terminal.