Linux+ 102

  1. /etc/passwd
    User account information


    Example: guru:x:464:464:Test account:/home/guru:/bin/bash
  2. /etc/group
    Group account information


    example: Staff:x:200:bob,joe,sally
  3. /etc/shadow
    • Encrypted passwords are stored in root user read only files. Also controls advanced password parameters such as password aging.
    • Structure:
    • login name
    • encrypted password
    • date, in days since epoch, of last change
    • number of days until change allowed
    • number of days until change required
    • number of days prior to expiration to begin warning
    • number of days after expiration before account disabled
    • date, in days since epoch, that password expires
  4. useradd
    • New users can be added to the system by the root user. useradd is controlled by:
    • command line options
    • /etc/login.defs config file
    • /etc/default/useradd config file
  5. userdel
    deleting existing users
  6. newusers
    bulk import of new users
  7. vipw
    opens default EDITOR for editing

    • /etc/passwd
    • /etc/group
  8. locking an account
    • usermod -L
    • passwd -l
  9. chfn
    used to change user's GECOS/finger information
  10. groupadd
    creating new groups
  11. groupdel
    deleting existing groups
  12. usermod -a -G
    append group additions
  13. preventing interactive login
    7th field of /etc/passwd

    • /bin/false -- simply exits with a return code 1
    • /bin/nologin -- exits with message "This account is currently not available." or the contents of /etc/nologin.txt if it is present.
  14. /etc/skel
    When useradd is used the contents of this directory are copied of the the new user's home directory.
  15. sudo
    • like su but adds:
    • ability to log commands run
    • ability to give more granular access to privileged commands on a user-by-user basis

    user must be in the /etc/sudoers file to use the command.
  16. ulimit
    Command provides control over the consumption of resources available to the shell and to processes started by it.

    • -a -- All current limits are reported
    • -c -- the max size of core files created
    • -d -- the max size of a process's data segment
    • -f -- the max size of files created by the shell
    • -l -- the max size that may be locked into memory
    • -m -- the max resident set size
    • -n -- the max number of open file descriptors
    • -s -- the max stack size
    • -t -- the max amount of cpu time in seconds
    • -u -- max # of processes available to a user
    • -v -- max amount of virtual memory available to shell
  17. /etc/profile
    system wide sh: configuration files
  18. ~/.profile
    per user sh: configuration files
  19. Spawn a new shell and run sprit_name
    • ./script_name
    • sh script_name
  20. Run script_name in the current shell
    • source script_name
    • . script_name
  21. bash: Configuration Files
    • when invoked as a login shell:
    • /etc/profile then
    • one of the three ~/.bash_profile, ~/.bash_login, ~/.profile
    • then ~/.bash_logout if it exists

    when invoked as a sub shell, ~/.bashrc
  22. add a default gateway
    route add default gw
  23. SQL: Insert
    INSERT INTO table (field, ...) VALUES (values, ...)

    • example:
    • INSERT INTO restaurant (name, category_id, rating) VALUES ('Macho Taco', 3, 5);
    UPDATE table SET field = 'value', ...WHERE condition, ...

    • example:
    • UPDATE restaurant SET rating = 4 WHERE name = 'Macho Taco';
  25. SQL: Select
    SELECT field, ...FROM table, ...WHERE condition, ...

    • example:
    • SELECT * FROM restaurant WHERE category_id = 2;
    • output: 1|Macho Taco|2|5
  26. SQL: Delete
    DELETE FROM table WHERE condition, ...;
  27. new aliases
    #vi /etc/aliases --- edit to add aliases

    # newaliases --- run to activate additions to aliases file
  28. Executes a task once at some time in the future.
    at or batch
  29. Executes a task at a recurring interval
  30. At system boot, runs jobs missed while the system was off.
  31. at -q
    batch -q
    • at uses queue "a" batch uses queue "b" by default. A-Z are available though.
    • Queues with higher letters are run with increased niceness.
  32. /etc/at.deny
    • if .deny exists, users that are listed in it can not use at; all others can.
    • if .allow exists, only users in that list are allowed to use at.
  33. /etc/cron.deny
    • if .deny exists, users that are listed in it can not use cron; all others can.
    • if .allow exists, only users in that list are allowed to use cron.
  34. crontab -l
    list/display the current cron table
  35. crontab -e
    edit the current cron table
  36. crontab -r
    removes the entire current cron table
  37. Cron directories
    • /etc/cron.d -- a more flexible crontab folder, allows specifying username.
    • /etc/cron.hourly
    • /etc/cron.daily
    • /etc/cron.weekly
    • /etc/cron.monthly
  38. anacron config file
  39. IPv4
    • 32 bit
    • contain 2 pieces (network,host)
  40. private addresses
  41. TCP
    • connection oriented
    • reliable
    • 20 byte header
  42. UDP
    • connection-less
    • stateless
    • lightweight
    • 8 byte header
  43. System services
    • /etc/services
    • file that helps identify most of the commonly used ports.
  44. TCP 20
  45. TCP 21
  46. TCP 22
  47. TCP 23
  48. TCP 25, 465
    SMTP SSMTP (mail)
  49. UDP 53
  50. TCP 80, 443
  51. TCP 110, 995
    POP3 POP3S
  52. TCP 119
    NNTP (news)
  53. UDP 139
  54. TCP 143, 993
    IMAP IMAPS (email)
  55. UDP 161
  56. IPv6
    • has 128bit addressing
    • first appeared in 1996
    • Header simpler
    • improved end-to-end security
    • Stateless auto-configuration
    • Greatly expanded IP address space
  57. common network interfaces
    • lo
    • eth
    • slip
    • ppp
    • isdn
    • tr
    • fddi
  58. Ethtool
    • +Enhanced functionality specific to Ethernet hardware
    • +Dispay and configure Ethernet inerface settings
    • +Display Available Options: ethtool (no parameters)
    • +Display Setitngs on Inerface: ethtool eth#
    • +Configure basic settings: ethtool -s eth# OPTION VALUE
  59. mii-tool
    • + OLD!
    • +Access to generic, hardware independent MII capabilities of most networking hardware
    • +May work better than ethtool on some old hardware
  60. Inerface configuration
    • /sbin/ifconfig
    • Start: ifconfig eth0 up
    • Stop: ifconfig eth0 down
  61. Identifies name servers and name resolution options

    only allows three nameserver entries, any additional entries are ignored.
  62. Identifies hostnames and aliases with IP addresses
  63. Generates UDP probe packets, to hopefully unused ports, with increasingly larger TTL values.
    • traceroute
  64. mtr
    A specialized traceroute like utility that sends ICMP Echo messages encapsulated in IP packets

    mtr can output results in many formats including a real-time updating display (default).
  65. netstat
    can be used to print network connections, routing tables, interface statistics, and masqueraded connections.

    • -rn view the routing table
    • -s view protocol statistics
    • -ta list all TCP connections and listening ports
    • -ua list all UDP connections and listening ports
    • -ape list TCP UDP and UNIX socket connections and their associtated state, user, program PID/name

    -taupen lists everything. good one to remember.
  66. scan list services listening on a remote machine
  67. main X configuration file.
  68. xwininfo
    frints out info about specific window. Info includes:

    • +placement
    • +Geometry
    • +color depth
  69. xdpyinfo

    Display info includes:

    • +Geometry
    • +color depth
  70. Different graphical logins
    • xdm -- not really inuse anymore
    • gdm -- standard
    • kdm -- used but not standard
  71. xhost
    command used to control host-based access

    xhost (+,-)

    • + adds
    • - takes away
  72. xauth
    • token-based X access control
    • tokens stored in $XAUTHORITY file ( ~/.Xauthority is the most common file)
    • uses the MIT_MAGIC_COOKIE_1

    xauth add -- adds stores MIT-cookie
  73. starting the X server
    • startX starts the full graphical interface
    • xinit starts X and opens a terminal
    • X only starts the X server and nothing else
  74. primary way of interacting with the hardware clock
  75. primary way of interacting with the system clock
  76. command used to synchronize the local system clock to a remote system running an NTP deamon
    • ntpdate
  77. deamon used to connect to NTP servers
    • ntpd
  78. ntpd config file
  79. /etc/syslog.conf
    config file for the syslogd deamon

    • +syntax
    • +selectors
    • +action
  80. standard location for log files
  81. syslogd
    • logs system messages
    • conffigured in /etc/syslog.conf
    • supports remote logging (-r option)
  82. klogd
    receives messages from the kernel and sends them to syslogd
  83. message priority level
    In order:

    • emerg
    • alert
    • crit
    • err
    • warning
    • notice
    • info
    • debug
  84. open source SQL databases
    • sqlite
    • mySQL
    • postgreSQL
  85. commercial/closed source SQL Databases
    • Oracle
    • IBM DB2
    • sybase
  86. create new aliases for email
  87. set up forward of mail
    edit the "~/.forward" file
  88. mail
    send an email, reply to an email,
  89. view the mail queue
  90. available MTA programs
    • Sendmail
    • Postfix
    • Exim
    • Qmail
Card Set
Linux+ 102