Linux File Permissions - morgan-hanrahan/Tech-Journal GitHub Wiki

Add Users and Groups

  • To add users use: useradd [name]
    • make sure to add a password for the user using: passwd [user]
  • To add a new group use: groupadd [groupname]
    • Adding a user to a group use: usermod -aG [groupname] [user]

Editing the File Permissions

  • To impersonate another user: su - [user]
  • To change the group of a directory use: chgrp [groupname] [filename/directory]
  • File permissions are easy to read:
    • The first '-' indicates the file type
    • The next three '---' are the user permissions (u)
    • The next three '---' after that are the group permissions (g)
    • The last three '---' are others permissions (o)
      • r = read
      • w = write
      • x = execute
  • To edit permission simply do: chmod [g, u, or, o][+ or -][rwx]
  • To make an owner do: chown [user] [filename]