Getting ready

Besides having a terminal open, we need to remember a few concepts:

  • sudo requires a password (unless specified)
  • sudo can also be limited to specific commands, users, or hosts
  • sudo commands are also logged in either /var/log/secure or /var/log/auth.log:
Dec 23 16:16:19 moon sudo: rbrash : TTY=pts/2 ; PWD=/home/rbrash/Desktop/book ; USER=root ; COMMAND=/usr/bin/vi /var/log/auth.logDec 23 16:16:19 moon sudo: pam_unix(sudo:session): session opened for user root by (uid=0)

Additionally, we can create a new user for this recipe:

$ sudo useradd bob$ sudo passwd bob #use password

Get Bash Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.