Terminal Command to Set File Permissions

Discussion in 'Mac OS X Server, Xserve, and Networking' started by SahtuDEC, Feb 27, 2014.

  1. SahtuDEC macrumors newbie

    Joined:
    Feb 27, 2014
    Location:
    NWT
    #1
    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
     
  2. drsoong macrumors member

    Joined:
    Mar 24, 2008
    Location:
    Munich
    #2
    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
     
  3. SahtuDEC thread starter macrumors newbie

    Joined:
    Feb 27, 2014
    Location:
    NWT
    #3
    Thanks for the help!

    That did the trick. Thank so much!:)
     
  4. drsoong macrumors member

    Joined:
    Mar 24, 2008
    Location:
    Munich

Share This Page