[opensuse] Is it possible to set group permissions = owner permissions
I would like to go through all files and subdirectories of a directory and set the group permissions equal to the owner permissions. Is there a command that will do this? This directory has thousands of files and hundreds of directories under it, so doing this manually isn't feasible. Thanks, Greg Wallace -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Greg Wallace wrote:
I would like to go through all files and subdirectories of a directory and set the group permissions equal to the owner permissions. Is there a command that will do this? This directory has thousands of files and hundreds of directories under it, so doing this manually isn't feasible.
find directory | while read f do setfacl -m `getfacl "$f" | grep user | sed s/user/group/` "$f" done Joachim -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Joachim Schrod Email: jschrod@acm.org Roedermark, Germany -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Tuesday, December 19, 2006 @ 5:15 AM, Joachim Schrod wrote:
Greg Wallace wrote:
I would like to go through all files and subdirectories of a directory and set the group permissions equal to the owner permissions. Is there a command that will do this? This directory has thousands of files and hundreds of directories under it, so doing this manually isn't feasible.
find directory | while read f do setfacl -m `getfacl "$f" | grep user | sed s/user/group/` "$f" done
Joachim
Joachim: Well, I tried this script but it didn't work. I put the above code into a file, hard coded /root/test for directory to point to a directory called test under root that had 4 files under it, and tried executing the script to see if it copied over the permissions. I got the following error when I tried to run it -- ': not a valid identifier line 1: read : `f Greg W -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Tue, Dec 19, 2006 at 10:19:42PM -0600, Greg Wallace wrote:
On Tuesday, December 19, 2006 @ 5:15 AM, Joachim Schrod wrote:
Greg Wallace wrote:
I would like to go through all files and subdirectories of a directory and set the group permissions equal to the owner permissions. Is there a command that will do this? This directory has thousands of files and hundreds of directories under it, so doing this manually isn't feasible.
find directory | while read f do setfacl -m `getfacl "$f" | grep user | sed s/user/group/` "$f" done
Joachim
Joachim: Well, I tried this script but it didn't work. I put the above code into a file, hard coded /root/test for directory to point to a directory called test under root that had 4 files under it, and tried executing the script to see if it copied over the permissions. I got the following error when I tried to run it --
': not a valid identifier line 1: read : `f
To code above is bourne shell code and the new lines are intended. You may replace the new lines with `;' ... find directory | while read f ; do setfacl -m $(getfacl "$f" | grep user | sed s/user/group/) "$f"; done Or within a shell script #!/bin/sh find ${1+"$@"} | while read f do m=$(getfacl --omit-header "$f" 2> /dev/null | sed -n 's/user/group/p') test -n "$m" || continue setfacl -m $m "$f" done Werner -- "Having a smoking section in a restaurant is like having a peeing section in a swimming pool." -- Edward Burr -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Greg Wallace wrote:
On Tuesday, December 19, 2006 @ 5:15 AM, Joachim Schrod wrote:
Greg Wallace wrote:
I would like to go through all files and subdirectories of a directory
and
set the group permissions equal to the owner permissions. Is there a command that will do this? This directory has thousands of files and hundreds of directories under it, so doing this manually isn't feasible.
find directory | while read f do setfacl -m `getfacl "$f" | grep user | sed s/user/group/` "$f" done
Joachim
Joachim: Well, I tried this script but it didn't work. I put the above code into a file, hard coded /root/test for directory to point to a directory called test under root that had 4 files under it, and tried executing the script to see if it copied over the permissions. I got the following error when I tried to run it --
': not a valid identifier line 1: read : `f
One thing that would be nice, would be if SUSE would allow individual user groups, when a user is created. As it currently is, with the "users" group and default permissions, anyone can read your home directory. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Greg Wallace wrote:
On Tuesday, December 19, 2006 @ 5:15 AM, Joachim Schrod wrote:
Greg Wallace wrote:
I would like to go through all files and subdirectories of a directory and set the group permissions equal to the owner permissions. Is there a command that will do this? This directory has thousands of files and hundreds of directories under it, so doing this manually isn't feasible.
find directory | while read f do setfacl -m `getfacl "$f" | grep user | sed s/user/group/` "$f" done
Well, I tried this script but it didn't work. I put the above code into a file, hard coded /root/test for directory to point to a directory called test under root that had 4 files under it, and tried executing the script to see if it copied over the permissions. I got the following error when I tried to run it --
': not a valid identifier line 1: read : `f
This error message is probably caused by wrong (i.e., non-Unix) line ends. Can you check that each line is only terminated by LF (\n, 0x0a) and does not have DOS style (CR-LR, \r\n, 0x0d0a). E.g., type head -1 your_script | od -t x1 and see if there is "0d 0a" at the end, or only "0a". The former is wrong and the latter right. If it's just "0a", we need to check further what your problem might be, you need to post your script then and describe exactly how you call it. I assume this problem cause because the "'" at the beginning of the error message line should actually be at the end of the error message; so there must be something that moves it to the start, and a CR is the most likely candidate. That may happen when you copy&paste from some mail client. Btw, if you write a script for these commands, remember that the 1st line should be #!/bin/sh . Joachim -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Joachim Schrod Email: jschrod@acm.org Roedermark, Germany -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (4)
-
Dr. Werner Fink
-
Greg Wallace
-
James Knott
-
Joachim Schrod