Linux File Permissions - adaley0518/Tech_Journal GitHub Wiki

Linux PuTTY file permissions

  • Add Users:

    • root directory (sudo -i if not in root directory)
    • useradd (input name)
    • passwd (input name)
    • ls /home (check if users exist)
  • Make Directory:

    • mkdir /[directory name]
    • ls -l / (will check if the directory was created)
    • rmdir /[directory name] (will remove directory)
  • Make file:

    • touch [filename.txt] (create file)
    • rm [filename] (remove file)
  • New Groups/Add Members:

    • root directory
    • groupadd (input group name)
    • usermod -aG [groupname] (user to add to group)
  • Change rwx Directory and File permissions:

    • root Directory
    • chmod [who][+,-,=][permission] /directory/filename
      • [who] can be g == group, u == user, o == other/global, a == all
      • [add, remove, same (g=u)]
      • [permission] can be r == read, w == write/modify, x = excute
      • Ex: chmod o-r /management/bobreview.txt
    • ls -ld /directory ( shows the permissions to the file)
    • chgrp name_of_group /directory
      • will change the group name of the directory
    • chown [input user name] /directory/filename (this will change the owner of a file/ will have to change group name as well ^)