Sponsored Content
Top Forums Shell Programming and Scripting mkdir: copying a folder's permissions Post 302345607 by avronius on Wednesday 19th of August 2009 04:44:30 PM
Old 08-19-2009
Solaris 10:
To copy permissions (and ACLs):
Code:
getfacl /directory > filename

To apply permissions
Code:
setfacl -f filename /new/directory


<edit>
This doesn't change the owner of the directory

To identify ownership and permissions of a directory:
[code]ls -l /path/that/source/directory/is/in | grep directory[code]
Then change the ownership of the new directory:
Code:
chown owner:group /target/directory

The permissions will appear as -rw-rw-rw or -rwx------ or something of that ilk

The first 'digit' will usually be -, but may be 4, 2 or 1 (depending on what has been configured - run a man on chmod for more details)
The next 3 sets of digits are the permissions for owner, group, and others (respectively).

To change the permissions of a directory, you will need to identify who needs
Understanding (r)ead (w)rite or e(x)ecute involves some math:
For:
Code:
Read = 4   Write = 2   Execute = 1
--x = 1
-w- = 2
-wx = 3
r-- = 4
r-x = 5
rw- = 6
rwx = 7

So, to set Read & Write for the OWNER only, you would:
Code:
chmod 600 filename

# ls -l filename
-rwx------   1 root     root           0 Aug 19 14:47 filename

</edit>

Last edited by avronius; 08-19-2009 at 06:00 PM..
 

9 More Discussions You Might Find Interesting

1. Windows & DOS: Issues & Discussions

folder permissions

I work for a big company and all the people within my unit share a common drive to save documents to. I am listed in the group(AMS group) that has access rights to folders within this drive. but i'm trying to restrict access to a confidential folder so that only I can access it. when I set the... (0 Replies)
Discussion started by: shed
0 Replies

2. Shell Programming and Scripting

script for Finding files in a folder and copying to another folder

Hi all, I have a folder '/samplefolder' in which i have some files like data0.txt, data1.txt and data2.txt. I have to search the folder for existence of the file data0.txt first and if found have to copy it to some other file; next i have to search the folder for existence of file... (5 Replies)
Discussion started by: satish2712
5 Replies

3. Shell Programming and Scripting

Copying latest file into a folder

Hello all, this is my first post while i am trying to understand unix. I would basically like to know if i can do this: Lets say i have a folderA and folderB And i save something in folderA Can i make a script that checks folderA latest file, then compares it with the date of latest file in... (16 Replies)
Discussion started by: takissd
16 Replies

4. UNIX for Dummies Questions & Answers

Permissions issue after copying files

Hi everyone, I am using mac os x 10.6, and I just copied over a project from a machine with 10.5... And I noticed my ls color is very funky in this directory... I found that my permissions are all messed up, and am wondering if there is a way to recursively fix permissions? This is how they... (3 Replies)
Discussion started by: patrick99e99
3 Replies

5. Homework & Coursework Questions

Copying Folder, C program

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Copying all the normal files from 1 folder to another on a unix platform. I pass in 1 or 2 arguments, the folder... (0 Replies)
Discussion started by: MW99
0 Replies

6. Shell Programming and Scripting

Folder permissions to delete

I am using the below command to delete files from directories and subdirectories find /test/abc/xyx -type f -mtime +7 -exec rm -f {} \; there are some subfolders in xyx for which i don't have permission to delete. Is there a way i can check the permission of the folder first and then delete... (4 Replies)
Discussion started by: ch33ry
4 Replies

7. Red Hat

Need to compare two folder / FS permissions

Hi, Need to compare two folders / File systems permissions & time stamps including sub folders and files. Kindly let me know if any commands available. Regards :: VM (1 Reply)
Discussion started by: novaothers
1 Replies

8. Ubuntu

Folder permissions

Hi Team, I want to set permissions to one folder in such a way that the user can write files or create folder inside that but should not able to delete it. Basically reason behind this is i am using Pidgin Messenger. There is a directory of logs in which, when user chat its store his logs.... (2 Replies)
Discussion started by: paragnehete
2 Replies

9. UNIX for Dummies Questions & Answers

Script for mkdir with permissions

Hello, I'm pretty new to scripting and trying to do a simple (well, I thought so) administrator task. I'm using bash. I want to create 10 directories under the one directory and apply permissions at the same time. I've worked out the make directories part: mkdir /userdata/folder{1..50}... (7 Replies)
Discussion started by: jimothy007
7 Replies
OPENCHANGEPFADMIN(1)					     OpenChange Users' Manual					      OPENCHANGEPFADMIN(1)

NAME
openchangepfadmin - Exchange users and Public Folder administration tool SYNOPSIS
openchangepfadmin [-?] [-?|--help] [--usage] [-f|--database PATH] [-p|--profile PROFILE] [-P|--password PASSWORD] [--apassword=PASSWORD] [--adesc=DESCRIPTION] [--acomment=COMMENT] [--afullname=NAME] [--list] [--mkdir] [--rmdir] [--comment=COMMENT] [--dirclass=CLASS] [--adduser=USERNAME] [--rmuser=USERNAME] [--addright=RIGHT] [--rmright] [--modright=RIGHT] [--debuglevel=LEVEL] [--dump-data] [--folder=FOLDER] [--username=USERNAME] DESCRIPTION
openchangepfadmin is a administrative command line tool designed to facilitate user management related operations (create, delete, modify) on a remote Exchange server and manage public folder store and permissions. COMMANDS
--adduser=USERNAME Create a Exchange user with the username specified by USERNAME --rmuser=USERNAME Delete the Exchange user account specified by USERNAME --list List Public Folder hierarchy (IPM_SUBTREE) --mkdir Create a folder in the Public Folder store --rmdir Delete a folder in the Public Folder store --addright=RIGHT Add permission and roles for a user on a Public Folder directory. --modright=RIGHT Modify permissions and roles for a user on a Public Folder directory --rmright Delete permissions and roles for a specific user OPTIONS
--database=DATABASE -f Set the MAPI profile database. If no database is specified, then openchangeclient tries to load the default one: $HOME/.open- change/profiles.ldb --profile=PROFILE -p Set the profile to use. If a profile is not specified, and one of the profiles has been set as the default in the profile database (for example, using mapiprofile -S), then that default profile will be used. --password -P Set the password for the profile to use. This can be omitted if the password is stored in the profile. --apassword=PASSWORD Define the password to set for the user specified with --adduser. If no password is explicitely supplied, openchangepfadmin will arbitrary set a random one. --adesc=DESCRIPTION This command can only be used with --adduser and specifies a description for this account --acomment=COMMENT This command can only be used with --adduser and specifies a comment for this account. --afullname=NAME This command can only be used with --adduser and specifies the user full name for this account. --comment=COMMENT This command can only be used with --mkdir and specifies a comment for the folder. --dirclass=CLASS This command can only be used with --mkdir and specifies the container class of the directory we want to create. Possible values are: IPF.Appointment, IPF.Contact, IPF.Journal, IPF.Note, IPF.StickyNote, IPF.Task, IPF.Post --folder=FOLDER This command can only be used with --addright, --modright and --rmright. Specify the folder where permissions and roles have to be changed. --username=USERNAME This command can only be used with --addright, --modright and --rmright. Specify the username we want to change permissions and roles for. --dump-data Dump the hex data. This is only required for debugging or educational purposes. --debuglevel LEVEL -d Set the debug level. EXAMPLES
Creating user openchangepfadmin --adduser=linuxowner --apassword=linuxowner --adesc="Linux Owner Test account" --afullname="Linux Owner" mapiadmin_user_add : MAPI_E_SUCCESS (0x0) username: linuxowner password: linuxowner Creates a user account with username and password set to linuxowner. Deleting user: openchangepfadmin --rmuser=linuxowner mapiadmin_user_del : MAPI_E_SUCCESS (0x0) Create Public Folder: openchangepfadmin --mkdir --folder=public_events --dirclass=IPF.Appointment Creates a folder in the Public Folder store named public_events with a container class set to Appointment. This folder will display calen- dar items. Delete Public Folder: openchangepfadmin --rmdir --folder=public_events List Public Folder hierarchy: openchangepfadmin --list Add Permission: openchangepfadmin --username=linuxowner --folder=public_events --addright=RoleOwner Permission RoleOwner added for linuxowner on folder public_events Modify Permission openchangepfadmin --username=Anonymous --folder=public_events --modright=RoleNone Permission changed to RoleNone for Anonymous on folder appointment Note that you can only change permissions for a user already listed in the ACL table. NOTE
Permissions and Roles possible values are: o RightsNone o RightsReadItems o RightsCreateItems o RightsEditOwn o RightsDeleteOwn o RightsEditAll o RightsDeleteAll o RightsCreateSubfolders o RightsFolderOwner o RightsFolderContact o RoleNone o RoleReviewer o RoleContributor o RoleNoneditingAuthor o RoleAuthor o RoleEditor o RolePublishAuthor o RolePublishEditor o RightsAll o RoleOwner SEE ALSO
AddUserPermission, ModifyUserPermission, RemoveUserPermission AUTHOR
Julien Kerihuel <j.kerihuel at openchange dot org> OpenChange libmapi 0.8 2007-11-14 OPENCHANGEPFADMIN(1)
All times are GMT -4. The time now is 07:05 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy