Terminal Command to Set File Permissions

SahtuDEC

macrumors newbie
Original poster
Feb 27, 2014
2
0
NWT
I have updated to Mountain Lion Server. My terminal commands are 'rusty'.

I want to change the permissions on the network home directories to match the firststudent in the list for the secondstudent:

macserver1:school data sahtudec$ ls -l /'school data/student home directories/firststudent'
total 0
drwxr-x---+ 7 sahtudec wheel 238 14 Feb 14:42 Desktop
drwxr-x---+ 34 sahtudec wheel 1156 5 Feb 09:49 Documents
drwxr-x---+ 68 sahtudec wheel 2312 14 Feb 14:42 Downloads
drwxr-x---+ 41 sahtudec wheel 1394 3 Feb 09:49 Library
drwxr-x---+ 3 sahtudec wheel 102 10 Sep 2012 Movies
drwxr-x---+ 3 sahtudec wheel 102 10 Sep 2012 Music
drwxr-x---+ 13 sahtudec wheel 442 26 Feb 12:51 Pictures
drwxr-xr-x+ 4 sahtudec wheel 136 10 Sep 2012 Public

macserver1:school data sahtudec$ ls -l /'school data/student home directories/secondstudent'
total 0
drwxr-xr-x+ 5 sahtudec wheel 170 21 Feb 17:36 Desktop
drwxr-xr-x+ 43 sahtudec wheel 1462 21 Feb 15:29 Documents
drwxr-xr-x+ 9 sahtudec wheel 306 13 Feb 08:39 Downloads
drwxr-xr-x+ 39 sahtudec wheel 1326 13 Feb 08:36 Library
drwxr-xr-x+ 3 sahtudec wheel 102 10 Sep 2012 Movies
drwxr-xr-x+ 3 sahtudec wheel 102 10 Sep 2012 Music
drwxr-xr-x+ 5 sahtudec wheel 170 16 Oct 2012 Pictures
drwxr-xr-x+ 4 sahtudec wheel 136 10 Sep 2012 Public
 

drsoong

macrumors member
Mar 24, 2008
56
1
Munich
chmod

The command you are looking for is chmod. Here a quick hint for your current problem, but I might not harm to do a "man chmod" and read about it in more detail on its manual page! :)

chmod -R o-rx <foldername>

where you do <foldername> for all folders, but Public which you don't want to change. The -R option applies these permission rules to all subfolders and files in those folders.

Maybe it might not harm to try it out on one folder first. It never harms to be safe than sorry.

chmod -R o+rx <foldername>

would give back reading (r) and executing (x) rights.

There is also a number-based short permission version, using 3,2,1 which is basically the decimal of a binary pattern of read, write and execute:

000 disallow all
rwx

111 allow all

for the users, other (o), group (g) and user (u).

More on the man page, or the web. ;)

-Drsoong