FOR 302 REVIEW Things to know for the CS 302 final exam Users How do I add a user? sudo adduser name What information is in /etc/passwd, /etc/shadow, /etc/group and /etc/gshadow /etc/passwd -> no actual passwords. Name, NumericId, home dir (where it puts you on login), shell (bash) info saved here /etc/shadow -> where encrypted password actually is. Takes first 2 char of username and uses that as salt for hash What is a userid? numeric id for individual userid = 0 means what? root Permissions How to read the output of 'ls -l'. first 3->user, then group, then other What permissions do I need to read/write/execute/delete RWX - delete is permissions on directory above r -> read w -> write x -> execute How do I change permissions chmod Crontab crontab -e -- edits the crontab crontab -l -- lists the crontab crontab --help Can you do something like "Every tuesday at 3:12am" yes-> m,h,dom,mon,dow -> 12, 03, *, *, 02 (dow is days of week. Sunday is both 0 and 7. Mon-Sat is 1-6) Can you do "every hour" yes -> 0, *, *, *, * Who runs as? cron of user. Root has their own, but will run as user Apache What is documentroot? Where is it set? /etc/apache2/mods-enabled/000-default.conf If I try and access http://me.nmu.edu/~fred, which files will it look for? userdir for fred- likely pub folder Where are the log files? /var/log/apache2 What is the difference between mods-available and mods-enabled mods-available don't fuck with, things COULD include. mods-enabled is what we have The thing. for files in , apply these things find vs grep find looks for filenames, grep looks for contents Who does apache run as? www-data for security reasons- NOT root alias? alias [URL] [FILEPATH TO THING] example: alias /secret /home/carchris/pub/mysecrets.html Email SMTP vs POP vs IMAP smtp -> push giving you email, sending it pop/imap -> pull, what email do you have for me What is mydestinations? Hostnames for people I will recieve and store email for Config file? /etc/postfix/main.cf How do I make an alias? What's the file, and what's the command? /etc/aliases -> sudo aliases name:whereitgoes How do I make a .forward? Where does it go? go to the persons home dir, file is .forward, contents are: where it should go, world readable, not world writable Where are the log files? /var/log/mail.log What is relay access denied you sent me email, not my destinations, not relaying it for you How do we block spam black lists/block lists no mail from these places baynsian analysis words and phrases of email features of the email header from the future, something is stupid/misformatted Command Line How do i find out if a service is running. sudo service [whatever] status sudo service [whatever] stop -> stops service sudo service [whatever] start -> starts service sudo service [whatever] restart -> restarts service (synonyms for systemctl) How do I find a file given it's filename? (find command) find -name filename /path/youre/looking/in (can use *) How do I find a file given some text within the file (grep command) grep whatever /path/youre/looking/in grep -i whatever /path/youre/looking/in (-i is ignorecase) Redirection of outputs/errors? 2> /redirects/errors/here > /redirects/output/here What is /dev/null and how do I throw away errors? DevNull is the abyss 2> /dev/null What are the filename matching wildcards. * - zero or more character ? - one character [0-9] - one character in a range Piping: What does "ls | wc -l" do? How many programs run? ls lists all files. The | gives that output to wc -l, which counts the # of lines outputted Executables/file redirection? both sides are executables for | > or < is a file redirection, left hand side is ALWAYS executable Given the output of 'ls -l' who can read/write/delete a file? the first 3 letters of the output are the permissions of the user, 2nd 3 are the permissions of the group, last 3 are others Shell Scripting ->->-> NOTE: I found a helpful page at: https://www.oreilly.com/library/view/learning-the-bash/1565923472/ch01s09.html (it contains some special characters and such to review) What does #!/bin/bash do? Means give text of this to /bin/bash, which knows how to execute How do I run a command and put the results in a variable (backtics) let B=`[command]` (or) B=`[command]` How do for loops and while loops and if statements work? (the [] are important for the while and if statements) for loop: for variable in list/file/whatever/1 2 3 4 .. N do stuff/code done while loop: while [ condition ] do stuff/code done if statement: if [ condition ] then stuff/code fi Know how cut works. cut -c 3-12 -> cuts a line by characters, only 3-12 will remain Know what backtics ` do d=`date` -> d becomes the output of the executable. ` surrounds commands For loops in shell (i.e. for i in /home/*) Same as for loops above. For i in /home/* it will do the thing for every file in /home/* What is $1 and $2? first and second arguments of a command. Example: "kill me slowly" -> kill is the command. Me is $1, slowly is $2 Samba Config file? /etc/samba/smb.conf How do I make a share named after a user? make a [homes] section in /etc/samba/smb.conf How do I set someone's password? sudo smbpasswd -a (adds passwd for first time, setting a password not first time no -a) How do I delete their account? sudo smbpasswd -x How do I make a share not named after a user? make a section in /etc/samba/smb.conf (the thing with the []) How do I make a share read only? include "Read Only = yes" in the share directory [bracket thing] NFS What infomation is in /etc/fstab? stuff that happens on bootup/reboot What infomation is in /etc/exports? /home [ip](rw, [jibberish]) <- basically starts a "share" saying if [ip] wants to access, they can in read/write mode How do I mount one time only by hand (the mount command) sudo mount server:/offer /where The Cloud About how much does it cost to have a cloud computer very very cheap What are some advantages (cheap, great connectivity, reliable, no labor for setup, etc) What are some disadvantages (not on local wire, secrecy etc) Does anyone run servers on bare metal (not vm) in 2021? (Yes, but the trend is strongly towards fewer) Apt-get install install this thing delete blow away, but leave config files purge delete EVERYTHING