Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Trying to set homogenized file permissions in /home/documents. Fail.

  1. #1
    Join Date
    Jan 2009
    Location
    Somewhere in Fictionland
    Posts
    1,479

    Question Trying to set homogenized file permissions in /home/documents. Fail.

    I recovered recently my documents from several machines, backups and installs. This gave a "nice mix" of different permissions from different identities. So I find /home/userx/documents owned correctly. I did set this property with "apply also to sub-folders". But this fails. So the different sub-folders and subsubfolders and so on, stay with their "historical" owners. My overall system file permission are set to "secure". I tried to set the permissions in dolphin with superuser-mode. Gave the ownership to the correct user....but still, this fails. I could do this from the command line as root. How would I do this correctly to set all the documents of user x to "owned by user x" and visible and accessible only by him? Should I (what happened to the "code tags" buttons anyway??)
    Code:
     su - chmod 700 /home/userx/documents
    Would this give the right effect to "homogenize" within the home directory in documents all sub-folder and file permission? Thank you.
    Last edited by hcvv; 21-Dec-2012 at 06:30.
    Just "clicking away" security warnings about a change in repo signature ? Not able to control?
    Then please vote for
    https://features.opensuse.org/312047
    openSUSE should have an efficient web of trust.

  2. #2
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: Trying to set homogenized file permissions in /home/documents.Fail.

    On 2012-12-21 13:56, stakanov wrote:

    > I could do this from the command line as root. How would I
    > do this correctly to set all the documents of user x to "owned by user
    > x" and visible and accessible only by him? Should I (what happened to
    > the "code tags" buttons anyway??)



    I do it this way (as root):

    Code:
    
    > #!/bin/bash
    > find /home/someuser/  -type f -exec chown someuser:users '{}' \;
    > find /home/someuser/  -type d -exec chown someuser:users '{}' \;
    > find /home/someuser/  -type f -exec chmod u+r+w,g-r-w-x,o-r-w-x '{}' \;
    > find /home/someuser/ -type d -exec chmod u+r+w+x,g-r-w-x,o-r-w-x '{}' \;
    --
    Cheers / Saludos,

    Carlos E. R.
    (from 11.4, with Evergreen, x86_64 "Celadon" (Minas Tirith))

  3. #3

    Default Re: Trying to set homogenized file permissions in /home/documents.Fail.

    > su - chmod 700 /home/userx/documents
    > Code:
    > --------------------
    > \ Would this give the right effect to "homogenize" within the home directory in documents all sub-folder and file permission? Thank you.


    This command will fail to do what you want on a default system for a few
    reasons:

    'documents' is not the name of the normal directory for such things; it
    may be your name, but for most of us it is 'Documents' (case-sensitive).

    The command only affects the directory itself, and is not recursive. Add
    -R to make it recursive.

    Use 'sudo' instead of 'su'. The syntax above is almost right for sudo,
    and almost right for su, but wrong for both of them.

    In the end, try this:

    sudo chmod -R 700 /home/userx/Documents

    What this does, literally, is apply read, write and execute bits to all
    files and directories from /home/userx/Documents on down until there is
    nothing left to affect. It does so as the 'root' user so there is nothing
    that should stop it from working. Having the execute bit on regular files
    (vs. directories) is typically not a good idea, so your next task is to
    figure out how to remove those, or alternatively to not set them in the
    first place and then fix directories by adding execute to them. In that
    case, do the following:

    sudo chmod -R 700 /home/userx/Documents

    Again, fixing directories (vs. files) is left as an exercise for the
    reader, but it's pretty easy using 'find'.

    Good luck.

  4. #4
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,158

    Default Re: Trying to set homogenized file permissions in /home/documents. Fail.

    It might be that Carlos did understand your wish and gave the ultinalte solution. In that case you can skip the following.

    First, you ask:
    what happened to the "code tags" buttons anyway?
    As that button (denoted by the # in it) is sittiing in the toolbar of my post editor as I am writing this (and it was there for years), I do not quite understand you. As with any problem, you have to describe what you did (saw, etc.), what you expected to get from what you did and what you got instead. Else others have to guess a lot and tat is an invitation to misunderstanding.

    Then I do not know what the word "homogenized" means here, but when you mean (I do guess here, take care) that you want to change ownership with chmod of a directory and everything that is in it and everything that is in directories that are in it and so down the tree, then I can tell you that that is called "recursive". And as you read
    Code:
    man chown
    you will see that you can change recursively using the short option -R or the long option --recursive.
    Same for chmod.
    Henk van Velden

  5. #5
    Join Date
    Jan 2009
    Location
    Somewhere in Fictionland
    Posts
    1,479

    Question Re: Trying to set homogenized file permissions in /home/documents.Fail.

    Quote Originally Posted by ab View Post
    > su - chmod 700 /home/userx/documents > Code: > -------------------- > \ Would this give the right effect to "homogenize" within the home directory in documents all sub-folder and file permission? Thank you. This command will fail to do what you want on a default system for a few reasons: 'documents' is not the name of the normal directory for such things; it may be your name, but for most of us it is 'Documents' (case-sensitive). The command only affects the directory itself, and is not recursive. Add -R to make it recursive. Use 'sudo' instead of 'su'. The syntax above is almost right for sudo, and almost right for su, but wrong for both of them. In the end, try this: sudo chmod -R 700 /home/userx/Documents What this does, literally, is apply read, write and execute bits to all files and directories from /home/userx/Documents on down until there is nothing left to affect. It does so as the 'root' user so there is nothing that should stop it from working. Having the execute bit on regular files (vs. directories) is typically not a good idea, so your next task is to figure out how to remove those, or alternatively to not set them in the first place and then fix directories by adding execute to them. In that case, do the following: sudo chmod -R 700 /home/userx/Documents Again, fixing directories (vs. files) is left as an exercise for the reader, but it's pretty easy using 'find'. Good luck.
    Thank you both ab+Carlos for your help. Actually the name would be Documenti in my case. Now, while I do understand mostly what you both do, I am somehow puzzled why I do need the execute bit in documents at all? Wouldn't this be necessary only for executables or scripts? Sorry maybe this is a bit a "dull" questions, but I am rightly puzzled by the necessity and usefulness of having the executable set, and your remark did foster this "curiosity" or let us say, made me clear that, with regard to "execute" I do have not a clear idea. Besides, what should be the correct setting of /home/user in terms of permissions (assuming that file permissions are set to secure). Thank you. @Carlos: I did find the help on "find" command and there the syntax of -exec. But where can I find the meaning of "type f" and "type d". As the --help seams to take the knowledge of these "for granted".
    Just "clicking away" security warnings about a change in repo signature ? Not able to control?
    Then please vote for
    https://features.opensuse.org/312047
    openSUSE should have an efficient web of trust.

  6. #6
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,158

    Default Re: Trying to set homogenized file permissions in /home/documents. Fail.

    You realy would help yourself by reading through those man pages. The chmod one tells you in short where the r, w and x bits are for in what cases. I could of course do the copy/pasting for you when you realy want to.

    (BTW, I changed the typo you made in the CODE tags in your original post).

    Also it is not "type", but Carlos clearly posted "-type". And that is also clearly explained in
    Code:
    man find
    Henk van Velden

  7. #7
    Join Date
    Jan 2009
    Location
    Somewhere in Fictionland
    Posts
    1,479

    Default Re: Trying to set homogenized file permissions in /home/documents. Fail.

    Quote Originally Posted by hcvv View Post
    You realy would help yourself by reading through those man pages. The chmod one tells you in short where the r, w and x bits are for in what cases. I could of course do the copy/pasting for you when you realy want to. (BTW, I changed the typo you made in the CODE tags in your original post). Also it is not "type", but Carlos clearly posted "-type". And that is also clearly explained in
    Code:
    man find
    The fact is that sometimes you do not remember. For example how to make manpages readable. So now I found again
    Code:
     man -t find | ps2pdf - > find.pdf
    and I have now a nice pdf with find. I do not know why, but I literally cannot read white on black background. But yes, you can put these questions under "signal overload". Too many things you are unsure about give at the end a bad result. Will go through this and see if later I still do not understand. And will ask again then. (That does not clear the need of the execbit thing though). Oh, and about your first post: I did not know what recursive means. So it would not have helped me to see that there is recursive...(for me it seemed to mean something like circular...but I will have to look it up in a dictionary to understand well. The code buttons do not appear in my browser window. Using no script maybe the reason? But I did allow all the site opensuse, and novel and attachmate temporarily. Still no buttons there to be seen. This is the reason why I asked about the code-buttons. Actually, I do not see any toolbar. Weird. Have to do all "by hand". And finally: yes I meant "recursively" if it means to take ownership (one ownership with the same rights and rules) of the Documenti folder and all folders and files below it Thank you for telling me about where to find the -type thing.
    Just "clicking away" security warnings about a change in repo signature ? Not able to control?
    Then please vote for
    https://features.opensuse.org/312047
    openSUSE should have an efficient web of trust.

  8. #8
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,158

    Default Re: Trying to set homogenized file permissions in /home/documents. Fail.

    You handle several subjects in one post without even making different paragraphs out of them That is more difficult to read then any man page

    The fact that you talk about it being difficult for you to read white characters on a black background is due to the fact that your terminal emulation does so. Has nothing to do with the man program. But you could improve that and all your terminal working by configuring your terminal emulator program to your needs.
    I personaly mostly read man pages using Konqureor. As an example, start Konqui and put
    Code:
    #find
    in the address bar.

    The problem was not that you did not know the (let us call it loosely "correct") word "recursive' for what you wanted, but you invented the word "homolo...." (or what was it) for it without describing your real needs. When you describe precise what you have, want, etc. people here will understand (and feed you with the word if needed). And a description is mostly not enough, There should be computer facts because they explain much more then stories. Thus a
    Code:
    ls -l documents
    would have illustrated it much better (and it would have revealed that "documents" was an invented name by you, something you never should do).

    The toolbar. I use FF with NoScript. Using the Forums I have no blocked scripts (check that there is no "red" anymore in the NoScript icon. The toolbar is very handy (not only for CODE) and the fact that your post editor/composer is not complete may also explain why there is no layout (like new lines) whatsoever in your posts.
    Henk van Velden

  9. #9
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: Trying to set homogenized file permissions in /home/documents.Fail.

    On 2012-12-21 14:56, stakanov wrote:


    > I am somehow puzzled why I do need the execute bit in documents at
    > all? Wouldn't this be necessary only for executables or scripts?


    Just remove that bit, and then try to browse that directory.
    Experiment :-)

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 11.4, with Evergreen, x86_64 "Celadon" (Minas Tirith))

  10. #10
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: Trying to set homogenized file permissions in /home/documents.Fail.

    On 2012-12-21 15:26, stakanov wrote:

    > The fact is that sometimes you do not remember. For example how to
    > make manpages readable. So now I found again
    > Code:
    > --------------------
    > man -t find | ps2pdf - > find.pdf
    > --------------------
    > and I have now a nice pdf with find. I do not know why, but I literally
    > cannot read white on black background.


    I see "man find" in black text on white background. Just choose a
    terminal you like or configure it. You can also see manpages in
    konqueror, I think it is "man:find".

    However, the documentation of some complex commands is not in the "man",
    but in "info". If you don't like "info" (many don't) use instead "pinfo".

    > Oh, and about your first post:
    > I did not know what recursive means.


    In computerese it has a definite meaning. In the case of filesystems, it
    means that whatever you do, when you find a directory you enter it and
    repeat the action; and the same on every directory you find then. That
    is, that you traverse the entire tree from the starting branch.

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 11.4, with Evergreen, x86_64 "Celadon" (Minas Tirith))

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •