Basically, we’d started converting a group of OS-X users to active directory, and problems with directory permissions were arising. However, once on AD the users lost permissions to access their original local folders (note: it has been a while, but it was along those lines).
I had been asked to find the solution (which is very simple) because I have a mad love affair with command line interfaces. These directions are fairly specific because not all of techs helping implement the solution had working knowledge of command line interfaces or OS-X. For advanced users this solution most likely seems obvious.
How to Change the Owner of a Folder via CLI (command line interface)
- Open a terminal
- Change to the /users directory
- Enter the command: ls -l
This will display a list of the current directory, and all of the owners and permissions of the sub-folders/files within. The output will be similar to the following:
total 0
drwxr-xr-x 15 OnADNow OnADNow 510 Nov 9 11:59 OnActive.Directory
drwxr-xrwx 12 PreAD PreAD 408 Nov 9 10:47 PreAD
The third column tells us who owns the folder and the fourth column lists the directory names. In the output above, the folder \users\PredAD is owned by the user named PreAD. The problem is that the user, whose account on AD is named OnADNow, doesn’t have permissions to access his old folder called PreAD (ie – he can’t access his pre-migration folder).
Enter the command: sudo chown OnADNow /users/PreAD
This will change the owner of the folder /users/PredAD to OnADNow. Note: Issue the command with sudo and use the absolute path. The user name and path are both case sensitive.
Reissue the command: ls -l
The output will look similar to this:
total 0
drwxr-xr-x 15 OnADNow OnADNow 510 Nov 9 11:59 OnActive.Directory
drwxr-xrwx 12 OnADNow PreAD 408 Nov 9 10:47 PreAD
The owner of the folder users/PreAD/ has changed to the user named OnADNow. This changes the owner of the group to support, but it doesn’t change the ownership of the contents of the folder. If you change in to the directory /users/PreAD and issue the command ls -l, you will notice the contents of /users/PreAD still belong to the user named “PreAD”.
So, to change the ownership of the folder’s contents the -R delimiter must be used: sudo chown -R support /users/PreAD/
The -R delimiter will recurse through all of the sub-directories and change the ownership of everything in /users/test.
Popularity: 1% [?]