The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to copy owner permissions to group ynixon UNIX for Dummies Questions & Answers 4 09-04-2008 11:29 AM
copy a fs with the same privileges itik AIX 3 05-08-2008 03:09 PM
Privileges User ((Please urgent)) AIX122 AIX 6 02-25-2008 05:53 AM
new user - basic privileges melanie_pfefer UNIX for Advanced & Expert Users 1 12-07-2006 12:49 PM
User Privileges gdboling UNIX for Advanced & Expert Users 1 10-29-2002 06:10 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-14-2008
The Dark Knight The Dark Knight is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 14
Cool How can i copy user permissions(privileges) to a group

Hey there

I have a problem and i was hoping that you guys could help me out

I want to copy a user privileges to a group and i need to copy all privileges(Recursively) every directory with all its sub directories and I tried some solution and it did not work. I used the following command:-

find $1 -exec /bin/sh -c 'chmod g+`ls -ld "{}" | cut -c2-4` "{}"'

I used this one and I'm new to AIX, and I don't know where does the group name supposed to go or the initial directory and I'm in a huge mess.

so could you please tell me what went wrong or give me another solution that would be great

Thanks in Advance

Last edited by otheus; 10-14-2008 at 06:41 PM.. Reason: Moved - I think this is a general question. Not really AIX specific.
  #2 (permalink)  
Old 10-14-2008
cfajohnson's Avatar
cfajohnson cfajohnson is offline Forum Advisor  
Shell programmer, author
  
 

Join Date: Mar 2007
Location: Toronto, Canada
Posts: 2,362

You are missing the final semi-colon:


Code:
find $1 -exec /bin/sh -c 'chmod g+`ls -ld "{}" | cut -c2-4` "{}"' \;

  #3 (permalink)  
Old 10-15-2008
The Dark Knight The Dark Knight is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 14
Quote:
Originally Posted by cfajohnson View Post

You are missing the final semi-colon:


Code:
find $1 -exec /bin/sh -c 'chmod g+`ls -ld "{}" | cut -c2-4` "{}"' \;


thanks but i still having the same error I have logged in with the owner of the folder then directly typed the exact command above and i keep getting the same error:-

Usage:find Path-list [Expression-list]

so if any one have any suggestions that would be great
Thanks for your cooperation
  #4 (permalink)  
Old 10-15-2008
cfajohnson's Avatar
cfajohnson cfajohnson is offline Forum Advisor  
Shell programmer, author
  
 

Join Date: Mar 2007
Location: Toronto, Canada
Posts: 2,362

What is the value of $1? If it may be empty, try this:


Code:
find ${1:-.} -exec /bin/sh -c 'chmod g+`ls -ld "{}" | cut -c2-4` "{}"' \;

  #5 (permalink)  
Old 10-15-2008
The Dark Knight The Dark Knight is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 14
Quote:
Originally Posted by cfajohnson View Post

What is the value of $1? If it may be empty, try this:


Code:
find ${1:-.} -exec /bin/sh -c 'chmod g+`ls -ld "{}" | cut -c2-4` "{}"' \;

I tried it and i got this error

ls: 0653-341 The file {} does not exist.
chmod: {}: A file or directory in the path name does not exist.

it seems that i should specify the initial directory but I'm not sure

What you think?
  #6 (permalink)  
Old 10-15-2008
The Dark Knight The Dark Knight is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 14
I also tried the command
find ${1:-.} -exec /bin/sh -c 'chmod g+`ls -ld "/home/username/" | cut -c2-4` "/home/username"' \;
and it worked with no problem but the permissions did not change a bit.
  #7 (permalink)  
Old 10-15-2008
otheus's Avatar
otheus otheus is offline Forum Staff  
Moderator ala Mode
  
 

Join Date: Feb 2007
Location: Innsbruck, Austria
Posts: 1,886
I didn't understand what you meant by "copy user privileges to a group" associated with the above code. Are you trying to make sure that a particular user's group owns all the files in a directory tree (not change the user-owner)?
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:17 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0