Question | Answer |
What is the purpose of /etc/profile or /etc/bash.bashrc? | These files are used to set environment configurations for all users. Eg: alises set here are set for all users |
What is the purpose of the env command? | Without options: list set environment variables (set by itself shows shell variables). Can also be used to run a command/script using specific(different) environment. |
What command is used to make a variable an environment variable, and what does that mean? | export VARIABLE="value" will make VARIABLE usable in all shells, not just the current shell. |
What is the purpose of the set command? | Sets various options that affect the user environment. |
How does the -a option function on the set command? | export variables that are defined, basically works like an export command |
How does the -f option function on the set command? | disable globbing (like using * for all filenames) |
How does the -o option function on the set command? | This option is used for many sub options ie: ingoreeof = don't exit shell on ctrl-d, markdirs = give trailing / to directories, noclobber = prevent > from truncating existing files, nounset = treats unset parameters as an error (-u also does this) |
How does the -v option function on the set command? | print shell input lines as they are red (good for debugging) |
How does the -x option function on the set command? | print command and their arguments as they are executed (good for debugging) |
What command is used to delete an environment variable? | unset <ENV VARIABLE> |
What is the difference between .bash_profile, .bash_login and .profile files in users home directory? | All are environment configurations read by "login" shells, often set to simply read .bashrc, Bash checks for these files in order and uses the first that exists and is readable. |
What is the purpose of .bashrc? | Users individual environment configuration is stored here, it is run by interactive shells which are non-login |
What is the purpose of .bash_logout? | Performs whatever is inside the script after the logout command is issued |
What is the purpose of .bash_history? | Contains commands that the user has typed into the shell. Can set how many commands can be stored in .bashrc normally |
What is the purpose of a function? Funny sounding question! | Function is part of a script that performs a sub-task and can be called by other parts of the script. Eg: myfn() {; commands; }; |
What is the purpose of the alias command? | Can put in long options to commands to always use them or make a shorter/different command name to use a command. Eg: alias ls='ls --color=auto' |
What is the purpose of lists in scripting? | Not really sure but it MIGHT be the && and || operators... |
What is the syntax of a FOR loop? | for <variable> in <set of variable, or some kind of test>; do |
What is the syntax of a WHILE loop? | while <test statement>; do; <something>; done; This loop will continue while the test statement remains TRUE, until is the same syntax but will loop while the statement remains FALSE. |
What is the purpose of the test command? | It runs a test and will come back either true or false, commonly used in loops and scripts. |
What is the value of true and false using a test command? | 0 = true, 1 = false |
What kind of test is this? [ 4 -lt 5 ]? | Is 4 LESS THAN 5? |
What kind of test is this? [ 4 -gt 5 ]? | Is 4 GREATER THAN 5? |
What kind of test is this? [ 4 -le 5 ]? | Is 4 LESS THAN OR EQUAL TO 5? |
What kind of test is this? [ 4 -ge 5 ]? | Is 4 EQUAL TO OR GREATER THAN 5? |
What kind of test is this? [ 4 -eq 5 ]? | Is 4 EQUAL TO 5? |
What kind of test is this? [ 4 -ne 5 ]? | Is 4 NOT EQUAL TO 5? |
What kind of test is this? [ 'abc' == 'cba' ]? | Is 'abc' the same string as 'cba'? |
What kind of test is this? [ 'abc' != 'cba' ]? | Is 'abc' a different string than 'cba'? |
What kind of test is this? [ -n "$string" ]? | Is $string a non empty string? |
What kind of test is this? [ -z "$string" ]? | Is $string an empty string? |
What kind of test is this? [ -d filename ]? | Is filename a directory? |
What kind of test is this? [ -e filename ]? | Does filename exist? |
What kind of test is this? [ -f filename ]? | Is filename a regular file? |
What kind of test is this? [ -r filename ]? | Is filename readable? Can also test -w or -x for other file permissions. |
What is the syntax of an IF statement? | if [ some kind of test ]; then; do something; fi; Can also use elif and else statements to continue the if statement. |
How can you terminate a loop? | break |
How can you terminate a script? | exit |
How can you get user input into a script? | read <var1> <var2>; this waits for user input to be entered, ended by enter key (new line) |
What is the output of this command? seq 10 | Numbers from 1 to 10, one number per line |
What is the output of this command? seq 1 10 | Numbers from 1 to 10, one number per line |
What is the output of this command? seq 1 2 10 | Number 1, 3, 5, 7, 9, one number per line. Basically it counts from the first number to the last number in increments of the middle number. seq 1 10 10 would only output the number 1. |
What is the shebang line? What is it's purpose? | Shebang is #! followed usually with /bin/sh in a script. It is found at the beginning of the script and it used to indicate what is used to interpret it. |
How can you use command substitution? | 2 ways: $(command) or `command`. The second method uses BACKTICKS not quotes. |
How can you use math expressions? | 2 ways: $((expression)) or let variable= expression |
What is the command to make a new database in SQL? | CREATE DATABASE <name>; |
What is the command to make a new table in SQL? | CREATE TABLE <tablename> (fieldname fieldtype, 2ndname 2ndtype, etc...); Eg: CREATE TABLE employees (id int(5), name varchar(50)); |
What is the command to work on a specific database in SQL? | USE <databasename>; |
What is the command to delete a database in SQL? | DROP DATABASE <databasename>; |
What command is used to get general table information in SQL? | DESCRIBE <tablename>; |
What is the command to add new data (rows) into a table in SQL? | INSERT INTO <table> (fieldname, fieldname,...etc) VALUES (value1, value2,...etc); |
What is the command to edit data (rows) of a table in SQL? | UPDATE <table> SET field1=value1, field2=value2,...etc WHERE field#=value; |
What is the command to view data of a table in SQL? | SELECT <field1, field2, etc || *> FROM <table> WHERE <field> IS NOT NULL; The WHERE command here is optional to only gather some data of the table. |
What is the command remove data (rows) from a table in SQL? | DELETE FROM <table> WHERE <field>=<value> AND <field2>=<value2>; |
What is the command to sort data of a table in SQL? | SELECT *(or specific fields) FROM <table> ORDER BY <field> <ordertype>; <ordertype> can be asc=ascending, desc=descending and others. |
What is the command to sort data of a table into groups in SQL? | SELECT *(or specific fields) FROM <table> GROUP BY <field to group by>; For example this could be used to group people who are born in the same month together. |
What is the command to join data from 2 tables in SQL? | SELECT table1.field1, table1.field2, table2.field1 AS <newfieldname> FROM table1,table2 WHERE table1.field1 = table2.field2; This would make a table with 3 fields (1 from table 2 + 2 from table 1), the AS statement changes the title of one of the fields |
What is an INNER JOIN in SQL? | SELECT * FROM <table1> INNER JOIN <table2> ON <table1.field> = <table2.field>; INNER JOIN produces only records that match in tables selected. |
What is an FULL [OUTER] JOIN in SQL? | SELECT * FROM <table1> FULL JOIN <table2> ON <table1.field> = <table2.field>; All records are shown joining matching sets where available. |
What is an LEFT [OUTER] JOIN in SQL? | SELECT * FROM <table1> LEFT JOIN <table2> ON <table1.field> = <table2.field>; Left (first) table all data shown, right (second) table only matched data shown. |
What is an CROSS JOIN in SQL? | SELECT * FROM <table1> CROSS JOIN <table2>; || SELECT * FROM <table1>, <table2>; no filter, joins every row from 1st table to every row from 2nd (makes a long table!). |
What is contained in the file /etc/X11/xorg.conf? | Sets up desktop gui, Device= video card; Monitor= refresh, resolution, etc; Screen= order of monitors (layout); Module= drivers for hardware; ServerLayout= links all other sections together; InputDevice= mouse + keyboard; |
What command is used to run remote X window commands on a local system? Why isn't it used anymore? | xhost <+|-><hostname|IP>; this gives permission (or take away) for people to use this feature. Not used since not encrypted, SSH tunneling used instead. |
What environment variable needs to be set to allow a remote computer to use X window? | DISPLAY=<IP of remote>:<display#>; Eg: export DISPLAY=192.168.1.2:1.0 |
What command is used to get technical info on a specific window display? | xwininfo; type command and then click on a window with mouse to get info if used without options. |
What command can be used to get info on current display, like X version, resolution, colour depth? | xdpyinfo |
What command is used to generate a default Xorg config file? | X (or xorg) -config |
What option in a xorg.conf file would set the font server? | FontPath "unix/:-1" |
What is the difference between Bitmap and Outline fonts? | BITMAP can have scaling problems, OUTLINE scales easily but might look ugly! |
How does the /etc/inittab affect your GUI? | It sets the default runlevel; id:#:initdefault: ... #=5 would make gui login |
What is the xdm config file? (full path) | /etc/X11/xdm/xdm-config |
Where do you set the greeting for xdm? (full path) | /etc/X11/xdm/Xresources ; xlogin*greeting is for the greeting message |
What file controls access for remote login to xdm? (full path) | /etc/X11/Xaccess |
What is the kdm config file? | /usr/share/kde4/config/kdm/kdmrc || /etc/X11/kdm || /etc/kde/dem ; this depends on the distribution; uses "[sections]" like rsync config |
How can you configure xdm to allow remote sessions? | Edit /etc/X11/xdm/xdm-config ; change DisplayManager.requestPort: 0 ; 0 changes to 177 |
How can you configure kdm to allow remote sessions? | Edit the config file (depends on the distro) and [xdmcp] Enable=True |
How can you configure gdm to allow remote sessions? | Edit the config file /etc/gdm/custom.conf ; [xdmcp] Enable=True |
What is the gdm config file? (full path) | /etc/gdm/custom.conf ; uses "[sections]" like rsync config |
What are Sticky Keys? | Allows using key combination (ctrl+alt+delete) by pressing keys one at a time instead of simultaneously |
What are Repeat Keys? | Change the delay required before multiple keystrokes are logged when holding down a key |
What are Slow Keys? | Allows setting a delay for how long a key is held down before it is detected at all.
Helps prevent keys pressed accidentally or more than once in quick succession. |
What are Bounce Keys? | Only a single key stroke logged when a key held down, after set time a second keystroke registers. |
What are Toggle Keys? | Sound alert gets played when CAPS LOCK or NUM LOCK are activated |
What are Mouse Keys? | Control the mouse with the arrow keys from a keyboard. |
What is a screen reader and which ones are generally available to use? | Reads out the text that appears on screen. Orca and Emacspeak are examples. |
What is Orca, what is it capable of? | Orca is an Accessibility feature in Linux, performs screen reading, braille display, magnifier |
What is an On-Screen Keyboard? Example? | Keyboard displays on screen to be used with a mouse instead, GOK is a popular example. |
What are Gestures? | Moving the mouse in different ways can perform actions like double clicking, right click, etc. |
What is the syntax used in the file /etc/passwd? | usernam : password : uid : gid : comment : homedir : startupshell |
What does an x mean in the password field of the /etc/passwd file? | Password is stored in the /etc/shadow file which is more secure. |
What does an * mean in the password field of the /etc/passwd file? | The account is locked |
What can you change the startupshell field in the /etc/passwd file to lock an account? | Set it to /bin/false or /sbin/nologin ; nologin is nicer in that it displays a message indicating the account is inaccessible so is preferred. |
What does ! mark mean in the /etc/shadow file? | ! in password field means none set, ! at the beginning means its a locked account. |
Where does Linux store group information, and what is the syntax? | /etc/group is the file and the syntax is groupname:password:gid: |
What directory functions as a template for new users? | /etc/skel |
What command is used to modify passwd settings like min days for password change, maximum inactivity, etc? | chage; passwd and usermod are also able to do many of the same things |
What does the -E option do when used with chage? | Set date for password to expire |
What does the -I option do when used with chage? | Set number of days of inactivity after password expire before locking account |
What does the -m option do when used with chage? | Set minimum number of days before password can be changed |
What does the -M option do when used with chage? | Set maximum number of days password is valid |
Which command is used to make a new group? | groupadd |
Which command is used to delete a group? | groupdel |
Which command is used to edit a group? | groupmod |
What does the -g option do for both groupadd and groupmod? | Set the GID |
What does the -r option do for groupadd? | Make the group a system GID (less than 500 or 1000 depending on the system) |
What does the -f option do for groupadd? | Force |
What does the -o option do for groupmod? | Allows 2 groups to share the same GID, must be used with -g |
What does the -n option do for groupmod? | Names a New Name, Nice! |
Which command is used to create a new user? | useradd |
What does the -c option do for useradd? | Set the comment field |
What does the -d option do for useradd? | Set the user home directory, must be used with the -m option |
What does the -e option do for useradd? | Set the expiration date (temp account) |
What does the -p option do for useradd? | Sets the password (must be pre-encrypted) |
What does the -M option do for useradd? | DOES NOT set a home directory for the user |
What does the -m option do for useradd? | Creates a home directory for the user (normally defaults to this) |
What does the -G option do for useradd? | Define secondary groups for the user |
What does the -g option do for useradd? | Sets the primary group for the user (normally is the same as the username) |
What does the -f option do for useradd? | Sets number of days after the password expires that the account remains unlocked so user can log in an change password (-l disables feature and is default) |
What does the -k option do for useradd? | Set to use a different template directory instead of /etc/skel ; requires the -m option to function |
What does the -f option do for userdel? | Force deletion of the user EVEN IF THEY ARE LOGGED ON! not good practice should kick them first before you kill them... |
What does the -r option do for userdel? | Remove user home directory and mail spool, not default since there might be data there that should be retained. |
What does the -d option do for usermod? | Change the user home DIRECTORY! |
What does the -e option do for usermod? | Set EXPIRE date on the user |
What does the -f option do for usermod? | Set number of days after account expired until permanently disabled...not sure why f... |
What does the -g option do for usermod? | Set the GROUP id/name of the users new default login group |
What does the -G option do for usermod? | Set the secondary GROUPS the user is a member of |
What does the -l option do for usermod? | Change the LOGIN name of the user |
What does the -L option do for usermod? | LOCK the account, -U = UNLOCK |
Where would you store a script that you wanted to run once a day? | /etc/cron.daily ; There are also directories for hourly monthly and weekly |
What is the purpose of the /etc/cron.d/ directory? | Stores any crontabs (not scripts) that use any timing you like to run as system crontab, more organized that putting everything into one large crontab |
As a system administrator how would you grant or stop a user from accessing the at daemon? | /etc/at.deny and /etc/at.allow files; one username per line; at.allow has priority and if neither files exist only root may use daemon. If only at.deny exists and it's empty everyone is allowed to use. |
As a system administrator how would you grant or stop a user from accessing the cron daemon? | /etc/cron.deny and /etc/cron.allow files; one username per line; cron.allow has priority and if neither files exist only root may use daemon.If only cron.deny exists and it's empty everyone is allowed to use. |
Where is the system crontab file stored? What is normally inside of this file by default? | /etc/crontab ; normally contains the commands to run the scripts in the /etc/cron.* directories. |
Where are the cron configurations files and the root conrtab file stored? | /var/spool/cron/* |
What does the -u option do when used with crontab command? | Open up a specified USERS crontab |
What does the -e option do when used with crontab command? | EDIT your crontab file |
What does the -l option do when used with crontab command? | LIST your crontab file |
What does the -r option do when used with crontab command? | REMOVE your crontab file |
How would you get crontab command to read a file instead of editing it manually? | crontab <filename> |
What does the -f option do when used with the at command? | Reads from a FILE instead of prompt. |
What formats does the at command accept for the time argument? | HH:MM; MMDDYY; MM/DD/YY; DD.MM.YY; Aug 16; Aug 16 2014; +2 hours |
When the at command is reading from the prompt how do you indicate the end of commands to run? | ctrl-d ; EOF |
What command is used to list pending at jobs? | atq |
What command is used to remove pending at jobs? | atrm <job #> |
What are the fields used for time in a crontab? (syntax) | Minuteofhour(0-59) Hourofday(0-23) Dayofmonth(1-31) Monthofyear(1-12) Dayofweek(0-7) |
If a cron job has a */40 in the minutes field and * in the rest, when will it be run? | It will run at the 0th and 40th minute of every hour. You would think */40 means every 40 mintues but this command only works properly for times that divide into 60 nicely. So this will have a 40 then 20 minute delay repeated. |
If a cron job has a 0-10 in the minutes field and * in the rest, when will it be run? How many times will it run in an hour? | It will run once a minute from the 0th minute to the 10th minute, so it will run 11 times in an hour. |
If you want a cron job to run on only Monday and Thursday, what would you place into the dayofweek field? | 1,4 |
What is the purpose of using >/dev/null 2>&1 in a cron job? | This will disable the e-mail notification that crontab normally sends. Sends it to /dev/null instead. |
If you wanted to run a cron job once a day, what is an alternate format that you can use instead of the 5 fields? | @daily ; options for @hourly, @monthly and @yearly exist as well |
What is the main file that Linux uses to check which timezone it is using? | /etc/localtime ; Often (and best practice) this will be a symbolic link to the timezone file in /usr/share/zoneinfo |
What is contained in the /etc/timezone file? | Text based file showing which timezone one resides: Eg. America/New_York |
How can you check which timezone is currently set on a system? | Use the date command, it will show the three letter timezone code currently being used. |
Where are the various timezone files stored? | /usr/share/zoneinfo |
What is the purpose of the LC_ALL environment variable? | If it is set it will override all other LC_* variables. Good for a temporary change. |
What is the purpose of the LANG environment variable? | It sets the locale in case the LC_* variables aren't set, like a fallback. If LANG=C there is no translation done by programs which is good for debugging. |
What is the purpose of the TZ environment variable? | This allows changing the timezone of specific users which you can set in their login scripts (remote user from another timezone). export TZ=:/usr/share/zoneinfo/America/Boston |
What is the purpose of tzselect? | CLI tool to help make time zone changes, ask for location in several steps |
What is the purpose of tzconfig? | GUI(ish) tool to help make time zone changes, ask for location in several steps |
What syntax is used to set the date using the date command? | DDMMhhmmYYYY (M=Month, m=minute) |
What command is used to convert the encoding of a text file? | iconv -f <fromcode> -t <tocode> ; --list will list all possible encondings |
What is ASCII? | Oldest most primitive encoding method, many non English punctuations and symbols not supported so not very good for international use. 7-bit encoding in an 8-bit (byte) |
What is ISO-8859? | Early attempt to extent ASCII, uses the 8th unused bit for extra characters. Broken into sub-standards to cover specific areas; Eg: ISO-8859-1 = western europe |
What is UTF-8? | Variable (1-4 byte encoding) extensions. Enables encoding of ANY language supported by Unicode. |
What is Unicode? | Character set designed to support as many languages as possible. |
How can you list the current locale settings on a machine? | locale command without additional arguments lists locale settings |
What is the format (syntax) of a locale setting? | language_TERRITORY.CODESET ; Eg: en_US.UTF-8 |
What does the -a option do to the locale command? | Displays ALL the locales available to use on a system |
What does the -m option do to the locale command? | list of all character MAPPINGS (maybe -c would have been a better choice for this, alas, --charmaps also does this!) |
Where is the config file for NTP? (full path) | /etc/ntp.conf |
What option inside of the NTP config file dictates which servers to use? | server <hostname or IP> ; normally will have more than 1 server configured and NTP will try to use the best ; /etc/ntp.conf |
What does the --hctosys (or -s) option do when used with hwclock command? | Hardware Clock will set the SYStem time, normally will be used with either --localtime or --utc to specify timezone |
What does the --systohc (or -w) option do when used with hwclock command? | SYStem time will set the Hardware Clock, normally will be used with either --localtime or --utc to specify timezone |
What does the -r (or --show) option do when used with hwclock command? | Displays hardware clock time in local time |
What does the --set option do when used with hwclock command? | Sets the hwclock, can also use --date=<newdate> in DDMMhhmmYYYY format |
What command is used to monitor the status of the NTP daemon? | ntpq ; -p will print the list of peers and a summary of their state |
What does it mean when the NTP daemon changes time by SLEWING it? | Small time difference between system and NTP server time (less than 0.5 seconds), it will adjust time less often |
What does it mean when the NTP daemon changes time by STEPPING it? | The time difference is large between the local computer and remote server (between 0.5 seconds and 17 minutes), adjusts time more frequently. |
What does it mean to have INSANE time? | There is a greater than 17 minute difference between local and NTP server time, NTP will poll other server to get time and ignore insane time. |
What does the -q option do when used with the ntpd command? | Basically mimics the ntpdate command which is supposed to be retired soon |
What command can be used to refresh system time with NTP servers? | ntpdate <server>; this will sync local time to the servers time. |
What does pool.ntp.org represent? | Pool of ntp servers, when you use it you will be given one of many possible servers.
Can get a different server in pool every time you launch ntp. |
Where is the system logging configuration file located? (full path) | /etc/syslog.conf |
What is the syntax of the syslog.conf? | facility.priority action ; commonly the action is the file to send the logs to but other options exist |
In syslog.conf what does this line represent? *.=crit -/var/log/whatevs | All facilities will send ONLY their critical priority messages to /var/log/whatevs using some kind of write-buffers (the -) |
In syslog.conf what does this line represent? mail,daemon.!crit @logger.domain.com | The mail and daemon facilities will send their messages of LOWER priority than critical to a remote machine logger.domain.com |
What is the purpose of klogd? | Manages logging KERNEL messages. |
Which command is used to send messages into various log files? | logger |
What does the -s option do to the logger command? | Sends ouput to STANDARD ERROR & the log file |
What does the -p option do to the logger command? | Sets the PRIORITY of the log |
What does the -t option do to the logger command? | Changes the TAG of the log; default tag is: logger |
How does a user set up mail forwarding? | pur username for local redirect or an entire e-mail address to send elsewhere in the ~/.forward file |
Where are mail aliases set? | /etc/aliases |
What is the syntax for the /etc/aliases file? | name: /dir/file OR |command OR :include:/dir/file (file of names) OR name@domain.com (full e-mail) |
What command is used to compile the /etc/aliases file? | newaliases |
What is the syntax to send a mail? | mail [options] to-address ; If reading message from prompt finish mail with a "." |
What does the -s option do to the mail command? | Sets the SUBJECT of the mail |
What does the -c option do to the mail command? | Sets the CC address of mail |
What does the -b option do to the mail command? | Sets the BCC address of mail |
What does the -f option do to the mail command? | Read mail...f? |
What does the -u option do to the mail command? | Check specified USERS mail |
What command is used to show mail that is in queue to being sent? | mailq |
Which mail program was designed as a modular replacement to sendmail, uses multiple programs to handle small tasks. | postfix |
Which mail program is non modular like sendmail, but easier to configure | exim |
Which mail program is design with security as a major goal. | qmail |
Where does user mail get stored? | /var/spool/mail |
How do you connect to the GUI CUPS configuration? | localhost:631 in a web browser |
Where is the cups configuration file located? (full path) | /etc/cups/cupsd.conf |
In the CUPS config file how do you set local printing? | Allow [from] 127.0.0.1 |
In the CUPS config file how do you set printing for a specific subnet? | Allow [from] 192.168.1.0/24 |
In the CUPS config file how do you set printing from local subnets? | Allow [from] @LOCAL |
What is the difference between Order Deny,Allow or Order Allow,Deny in CUPS config? | Deny first means default is deny unless in allow statement, Allow first means default is allow unless in deny statement |
Where are the CUPS printer definitions set? (full path) | /etc/cups/printers.conf ; easier to use the web based GUI |
What older (legacy) system was used for printing before CUPS? | lpd |
What command is used to send a file to print? | lpr [options] file |
What does the -P option set for lpr? | Sets the destination PRINTER |
What does the -# option set for lpr? | Set the NUMBER(#) of copies to print |
What does the -r option set for lpr? | REMOVE the file after printing |
What does the -m option set for lpr? | Send MAIL to specified username when job is completed |
What command is used to remove a print job from a specified printer? | Lprm -P<print> <job#> |
What command can you use to see the print jobs in queue and get their job #s? | lpq ; -P<printer> to check a specific printer |
What command is used to start stop and reorder the queue of jobs? | lpc ; cupsenable, cupsdisable and lpmove are also able to control the print queue. |
What file is used to map port numbers to names? (full path) | /etc/services |
What command is used as a simple replacement for nslookup? | host |
What is the -c option used for with the ping command? | Allows you to set the COUNT of pings to use instead of going until a ctrl-c is issued |
What command is used to get information on the owner of a FQDN? | whois |
How can you use dig to check for an MX record? | dig domain.com MX |
What does the -n option do with the traceroute command? | Uses IP address instead of performing hostname lookup, can save a lot of time. |
What is the difference between the tracepath and traceroute commands? | tracepath has output for each test packet, so longer output but fewer options than traceroute |
What does IPv6 use instead of ARP? | NDP ; Neighbour Discovery Protocol |
What does '::' mean in an IPv6 address? | This is placed between the largest set of quad 0s ; can only do it once in an address since more than once and you can't tell how many quad 0s go where. |
What are the private IPv6 addresses? | fec, fed, fee, fef |
What are the link local IPv6 addresses? | fe8, fe9, fea, feb...what a giant waste for link local... |
What service is port#: 20 associated with? | FTP Data |
What service is port#: 21 associated with? | FTP Control |
What service is port#: 22 associated with? | SSH |
What service is port#: 23 associated with? | Telnet |
What service is port#: 25 associated with? | SMTP |
What service is port#: 53 associated with? | DNS |
What service is port#: 80 associated with? | HTTP |
What service is port#: 110 associated with? | POP3 |
What service is port#: 119 associated with? | NTTP(Network News Transfer Protocol) |
What service is port#: 139 associated with? | NetBIOS Sessions (SAMBA) |
What service is port#: 143 associated with? | IMAP |
What service is port#: 161 associated with? | SNMP (UDP) |
What service is port#: 443 associated with? | HTTPS; HTTP over SSL |
What service is port#: 465 associated with? | SMTP over SSL; or URL Rendezvous Directory (URD) |
What service is port#: 993 associated with? | IMAP over SSL |
What service is port#: 995 associated with? | POP3 over SSL |
What file do many distros look at for hostname setting? (full path) | /etc/hostname ; some use /etc/sysconfig/network |
What file is used to associate hostnames to IP addresses locally? (full path) | /etc/hosts |
What file stores the DNS server information? (full path) | /etc/resolv.conf |
What file configures which method of hostname resolution to use, and in which order? (full path) | /etc/nsswitch.conf |
What file uses this syntax: 192.168.7.23 host.domain.com? | /etc/hosts |
What file uses this syntax: nameserver 192.168.7.23? | /etc/resolv.conf |
What file uses this syntax: hosts: files dns? | /etc/nsswitch.conf |
What command and syntax is used to configure interface eth0 with an IP of 192.168.2.2/24? | ifconfig eth0 192.168.2.2 netmask 255.255.255.0 broadcast 192.168.2.255 |
What commands can be used to bring an interface up/down? | ifup/ifdown interface; ifconfig interface up/down |
What command and syntax is used to add a default gateway of 192.168.26.1? | route add default gw 192.168.26.1 |
What command and syntax is used to set all packets addressed to 192.168.3.0/24 network to use the gateway 192.168.3.1? | route add -net 192.168.3.0 netmask 255.255.255.0 gw 192.168.3.1 |
If you want to set up your linux machine up as a router (forwarding packets) what file must you edit and what has to be in it? | /proc/sys/net/ipv4/ip_forward ; it has to have "1" inside to allow ip forwarding. |
What command is used to temporarily change a hostname on a machine? | hostname |
What does the -t option do when used with the netstat command? | Display TCP ports |
What does the -u option do when used with the netstat command? | Display UDP ports |
What does the -p option do when used with the netstat command? | Give the PROGRAM name |
What does the -a option do when used with the netstat command? | Display ALL ports (Established is default, show listening ports as well) |
What does the -n option do when used with the netstat command? | Display NUMERICAL IP instead of hostnames (no DNS lookup) |
What does the -i option do when used with the netstat command? | Display INTERFACE INFORMATION, somewhat similar to IFCONFIG command |
What does the -r option do when used with the netstat command? | Display the ROUTING info similar to ROUTE command |
What command is used as a packet sniffer (intercepts and logs network packets)? | tcpdump |
What does the -c option do when used with the tcpdump command? | Stop after a certain COUNT of packets (#). |
What does the -D option do when used with the tcpdump command? | Lists interface that tcpdump can listen on |
What does the -w option do when used with the tcpdump command? | WRITE to file instead of screen. |
What command would you use to find files owned by root with their SUID/SGID/both set? | SUID= find / -uid 0 -perm +4000; SGID= find / -uid 0 -perm +2000; BOTH= find / -uid 0 -perm +6000; |
Which command is used to display open files and who is accessing them (including over network)? | lsof |
What does the -i option do when used with the lsof command? | Shows all types of open files, you can refine the output with arguments like ipv4/6, tcp/udp, ip/hostname, :service/port(s) |
Which command is used to scan for open ports on local or remote computers? | nmap |
What does the -sT command do when used with nmap? | Check for open TCP ports |
What does the -sU command do when used with nmap? | Check for open UDP ports |
What file is used to configure users who are allowed to use the sudo command? (full path) | /etc/sudoers |
How do you edit who can get sudo privileges? | visudo |
What is the syntax used to give a user/group root sudo privilege? | username OR %groupname ALL= (ALL) ALL |
How do aliases work in the /etc/sudoers file? | You can set an alias such as Cmnd_Alias STORAGE=/sbin/fdisk, /sbin/sfdisk, /sbin/parted; And then do username ALL= STORAGE; which allows that user to use those commands set in alias. |
What types of aliases can be made in /etc/sudoers? | User_Alias (group users together), Runas_Alias (runs commands as a user), Host_Alias (group hostnames or IP networks), Cmnd_Alias (group commands) |
Which command is used to change user? | su = switch user |
What does the - option do when used with the su command? | Log onto user using their environment |
What does the -c option do when used with the su command? | Run a single command as the user (like sudo for root) |
What command is used to limit the resources that users are allowed? | ulimit |
What does the -H option do when used with the ulimit command? | Sets it to a HARD limit |
What does the -S option do when used with the ulimit command? | Sets it to a SOFT limit |
What are the various resources that ulimit can control? | memory (stack, rss, data, virtual), size (core, fsize), processes (nproc, cpu) |
What does the -a option do when used with the ulimit command? | Reports on the current settings |
What is the configuration file for pam_limits? (full path) | /etc/security/limits.conf |
What is the syntax for the pam_limits config file /etc/security/limits.conf? | domain type item value ; domain = user OR @group OR * ; type = hard OR soft OR - ; item = core, data, cpu,etc. ; value = ##s |
What are the various resources that can be controlled by the /etc/security/limits.conf file? | memory (stack, rss, data), size (core, fsize), processes (nproc, cpu, priority), files (nofile=# of open files), logins (maxlogins) |
What file if it exists will only allow root to log into system and for all other users simply show the file contents? | /etc/nologin |
What is the inetd config file? (full path) | /etc/inetd.conf |
What is the syntax of the inetd config file /etc/inetd.conf? | service stream|dgram tcp|udp wait|nowait root|guest|nobody /usr/bin/tcpd in.servicedaemon (Eg: tftpd) |
What is contained in the folder /etc/inetd.d/? | Configurations for specific services will generally reside here instead of in inetd.conf, makes it more manageable |
What is tcpd and how does it work? | Also called TCP wrappers. Adds security through access control and logging. Uses the hosts.allow and hosts.deny files to determine access rights. |
How does inetd provide any security? | inetd will utilize the tcpd (tcp wrappers) |
How do the /etc/hosts.allow and /etc/hosts.deny files function? | hosts.allow takes precedence so if it exists name MUST be in it to get access, if neither exists only root is allowed. |
What is the syntax of the /etc/hosts.allow and /etc/hosts.deny files? | daemon-list: client-list ; Eg: vsftpd:192.168.7. EXCEPT 192.168.7.105 |
What is the config file for xinetd? (full path) | /etc/xinetd.conf |
What is the difference in syntax between xinetd and inetd? | inetd has one long line to configure a server, xinetd break it up into individual options; ie: socket_type = stream; protocol = tcp; wait = no; user = root; server = /usr/sbin/in.ftpd; |
How does xinetd provide security? | does NOT use tcp wrappers like inetd, has security build in. bind = set to specific interface; only_from = like hosts.allow; no_access = like hosts.deny; access_times = when users allowed to log in (does not kick though) |
Where are individual server config files stored for xinetd? (full path) | /etc/xinetd.d/* |
What is the config file for ssh server? (full path) | /etc/ssh/sshd_config |
What is the config file for ssh client? (full path) | /etc/ssh/ssh_config |
What option in the ssh server config is used to allow/disallow root to log in? | PermitRootLogin yes/no |
What option in the ssh server config is used to allow/disallow tunneling for X? | X11Forwarding yes/no |
What is the difference between sshv1 and sshv2? | sshv1 is compromised and should no longer be used. sshv2 is secure still. |
Does ssh encrypt the data or the password exchange? | ssh encrypts both data and password exchange |
What is the syntax to connect to an ssh server called sshserver.domain.com as the user BLBrian? | ssh BLBrian@sshserver.domain.com |
What command is used to generate RSA and DSA keys? | ssh-keygen |
What is the purpose of the ssh-agent command? | Tool used to remember passwords so you only need to type it once per local session. USAGE: ssh-agent /bin/bash |
What is the command used to add private keys to be managed by ssh-agent? | ssh-add. Eg: ssh-add ~/.ssh/id_rsa ; after command it will prompt to type the passphrase |
Where are user RSA and DSA keys stored? | PRIVATE: ~/.ssh/id_rsa + ~/.ssh/id_dsa ; PUBLIC: ~/.ssh/id_rsa.pub + ~/.ssh/id_dsa.pub |
Where are the server RSA and DSA keys stored? | /etc/ssh/ssh_host_rsa(OR dsa)_key and ssh_host_rsa(OR dsa)_key.pub |
How can you set it up so that users can log in without the need for password using an rsa key? | Place public keys (id_rsa.pub type) in ~/.ssh/authorized_keys to authenticate users without the need for password |
Where would an admin place public keys of hosts that they trust? | /etc/ssh_known_hosts |
Where do the public keys of remote servers get stored when a user logs into them? | ~/.ssh/known_hosts |
What command can be used to encrypt and sign e-mail messages? | gpg (GNU Privacy Guard) |
Where do keys get stored that are created by gpg? | ~/.gnupg/ |
What is the command option to create a key using gpg? | --gen-key |
What is the command option to list the keys on keyring using gpg? | --list-keys |
What is the purpose of the --export option when using gpg? | This is used to put your public key to a file to share with others. |
What is the difference between the --sign and --clearsign options when using gpg? | sign = encrypt entire message, makes .gpg file; clearsign = only adds an encrypted signature so people can verify it came from you, makes a .asc file |
What does the --verify option do when used with gpg? | This is used to check if a signature on a received file is proper. |
What option in /etc/ssh/sshd_config is used to allow for port tunneling? | AllowTcpForwarding yes/no |
What does the -L option do when using ssh to port tunnel in this command? ssh –L 142:stuff.alcatel.com:143 BLBrian@meme.reddit.com | which port to listen to (local port 142 to port 143 on alcatel.com) |
With xdm what is the process of files used to set up the display? | Xsetup - sets up login screen >> Xstartup - after user logs in >> Xsessions >> Xreset - when the user ends the session to restart the cycle |
In what file is the GDM greeting set up? | /etc/gdm/custom.conf |
What does the --edit-key option do when used with gpg? | Presents a menu which enables you to perform key-related tasks |
What file must exist for the last command to function? | /var/log/wtmp |
What command is used to help configure CUPS? | lpadmin |
What is the LPD queue directory? (full path) | /var/spool/lpd |
What command is used to store passwords from the /etc/passwd file to the /etc/shadow file? | pwconv |
What is the purpose of the /var/run/utmp file? | Allows you to see who is logged in using the who command |
What command is used to check your gid and uid? | id |
How many bits in an ipv6 address? | 128 |
How many bits in an ipv6 address are for host bits? | 64 |
What command is used to delete the default gateway? | route del default gw |