Linux Basics/User management (System administrator)

From Wikibooks, open books for an open world
Jump to navigation Jump to search

The system administrator (superuser) and its functions[edit | edit source]

  • The most important user in Linux is: root
  • UID: 0, GID: 0
  • Root can access everything in the system!
  • The „su” command:
    • Changing user and executing command:
    • For example, we can become user mary:
      • su mary
    • If we use dash, then we get the whole environment of mary:
      • su - mary
    • We can add a group with the sg command. For example, we can add info:
      • sg info
  • Sudo command
    • With sudo command we can execute superuser commands. It asks the user's password, this is important because we don't want anybody to modify our system.
    • Ubuntu-based systems get root permissions only by sudo, root user doesn't get password.
    • We don't edit sudo's settings from directly the file. We use the following command instead: # visudo
    • Settings → in /etc/sudoers file
    • Syntax: <username> ALL=NOPASSWD: ALL Example: joska ALL=NOPASSWD: ALL
    • Without NOPASSWD it asks the given user's password.
    • Setting superuser permission: ALL=(ALL:ALL) ALL