You are not logged in.

#1 2014-02-17 22:58:20

Vi
Member
From: Garble garble garble
Registered: 2014-02-17
Posts: 7

[Solved] Changing File Permissions en masse using xterm/uxterm

the general question is, how can I set the permissions and ownership of files/folders en masse through the terminal?

I've been wandering around the net and I can't seem to find an answer at the moment...

Running with ICEwm and Cinnamon DE.

I've got my profile set as root, wheel, and users.






Edit: My apologies to the administration for ignoring forum etiguette.

Last edited by Vi (2014-02-18 00:06:31)

Offline

#2 2014-02-17 23:02:08

Neburski
Member
Registered: 2009-09-15
Posts: 118

Re: [Solved] Changing File Permissions en masse using xterm/uxterm

I'm inclined to think you will make a massive mistake, but here you go

man chmod

Offline

#3 2014-02-17 23:03:59

mychris
Member
From: Munich
Registered: 2012-09-15
Posts: 68

Re: [Solved] Changing File Permissions en masse using xterm/uxterm

What exactly do you want to do?
Both chmod and chown have a flag for recursion.
Xyne has a service in his repository to watch folders and adjust the permission of the files and folders in it: http://xyne.archlinux.ca/projects/autochown/

Offline

#4 2014-02-17 23:12:05

Vi
Member
From: Garble garble garble
Registered: 2014-02-17
Posts: 7

Re: [Solved] Changing File Permissions en masse using xterm/uxterm

Neburski wrote:

I'm inclined to think you will make a massive mistake, but here you go

I'm not that clumsy thank you, I did fry my jumpdrive... but that was in the process of learning.



I just did a more vague search in the wiki for what I was looking for and it came up with 'chmod' as well.

@mychris - I screwed up on my file back up and all my files are owned by root.

Root is to stay root, so that I don't inadverdently destroy my system.

Offline

#5 2014-02-17 23:12:51

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [Solved] Changing File Permissions en masse using xterm/uxterm

Please edit your first post and use a title that accurately reflects your question: the current one will just pollute search results:
https://wiki.archlinux.org/index.php/Fo … ow_to_Post


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#6 2014-02-17 23:17:28

mychris
Member
From: Munich
Registered: 2012-09-15
Posts: 68

Re: [Solved] Changing File Permissions en masse using xterm/uxterm

Vi wrote:

@mychris - I screwed up on my file back up and all my files are owned by root.

If all the files are in one directory and should be owned by one user you can use the recursive flags.
You can also use find with the exec flag to change permission/ownership.

Offline

#7 2014-02-17 23:21:48

Vi
Member
From: Garble garble garble
Registered: 2014-02-17
Posts: 7

Re: [Solved] Changing File Permissions en masse using xterm/uxterm

mychris wrote:

If all the files are in one directory and should be owned by one user you can use the recursive flags.
You can also use find with the exec flag to change permission/ownership.

They are all in one directory yes.

I shall be doing that once I finish my reading, been raised on doing almost everything through the GUI. Archlinux is a big jump, so I'll be moving slowly to avoid any big mistakes if I can help it.






Edit: Trains of thought wandered.

Last edited by Vi (2014-02-17 23:25:00)

Offline

#8 2014-02-17 23:33:41

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,822

Re: [Solved] Changing File Permissions en masse using xterm/uxterm

Neburski wrote:

I'm inclined to think you will make a massive mistake, but here you go

I second that.   You may also want to investigate the find command and its -exec command. 
It is a power tool.  One should be very careful with power tools.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#9 2014-02-17 23:55:05

Vi
Member
From: Garble garble garble
Registered: 2014-02-17
Posts: 7

Re: [Solved] Changing File Permissions en masse using xterm/uxterm

eh, if I screw up that's fine, I'm still learning how to properly work linux without a gui.

I'd really rather not screwup, but if it happens I'll just have to learn to fix the problem.

Offline

#10 2014-02-18 00:03:58

mychris
Member
From: Munich
Registered: 2012-09-15
Posts: 68

Re: [Solved] Changing File Permissions en masse using xterm/uxterm

Read the man page, understand the program and try it out. Especially with find and the exec flag, you can first execute find without the exec flag and see what files/folders your conditions meet and then execute it with the exec flag and actually do something.
If your permissions/owners are already screwed up, how can you screw up more? if everything is owned by root and you know the root pw, have sudo, ...., the worst thing which could happen is that it is no longer owned by root, but you can change it again
(execute the same find again, but change the -exec chown and point it to root...)
(execute the same recursive chown again, but change the owner...)
(...)

Last edited by mychris (2014-02-18 00:04:55)

Offline

#11 2014-02-18 00:29:05

Vi
Member
From: Garble garble garble
Registered: 2014-02-17
Posts: 7

Re: [Solved] Changing File Permissions en masse using xterm/uxterm

mychris wrote:

Read the man page, understand the program and try it out. Especially with find and the exec flag, you can first execute find without the exec flag and see what files/folders your conditions meet and then execute it with the exec flag and actually do something.

Sage advice, spent some time reading the man page of both chmod as well as chown.

Kept them both open while running both as root so that I could refer to them during the process.

mychris wrote:

If your permissions/owners are already screwed up, how can you screw up more? if everything is owned by root and you know the root pw, have sudo, ...., the worst thing which could happen is that it is no longer owned by root, but you can change it again

A few files were owner by root that shouldn't have, but using:

 chown username [file path /  directory / file name* and extension**]  

*only if you're in the directory the file is located in.
**if applicable.

While root fixed that problem.

Thank you for the help ladies and gentlemen, I apologize if irked your ire with this question.

Offline

Board footer

Powered by FluxBB