Linux Flashcards
Vem skrev kerneln för Linux?
Linus Torvalds
Vad gör en kernel?
It handles the communication between hardware and software. It is the “warehouse” that handles system calls.
Vad kallas “verktygslådan” för grundverktyg?
GNU Tools
Kernel + GNU Tools + övriga verktyg bildar en?
Distribution, t.ex. Ubuntu, Kali och MX
Vilka tre huvuddistributioner utgår de flesta ifrån?
Debian, Red Hat och Slackware
Vad kallas den grafiska grunden?
X-Windows, X11 eller “X”
Vad står GNU GPL för?
GNU General Public License
Vad är REPL?
Read-Eval-Print Loop
Vilket är det idag vanligaste skalet och vilket kan komma att ta över?
Most common today: Bash
Will most likely take over: z shell
Hur många root-kataloger finns det?
1, till skillnad från t.ex. Windows
Vad är FHS?
File Hierarchy Standard: where we SHOULD place files
Hur når man root som admin? (rootkatalog?)
cd /root
I vilken katalog finner användaren systemets konfiguration?
/etc
Hur kommer du som användare till katalogen för loggar?
How do you as a user get to the directory for logs?
cd /var/log
Var finns webroot-katalogen?
/var/www
Ta dig till din egen home-katalog:
cd /home/användare eller bara cd
Vad finner du i katalogen /dev ?
Alias files for hardware devices
Vad är syntaxen för kopieringskommandot?
What is the syntax of the copy command?
Enter: “cp” followed by “source” then “destination”.
Hur många och vilka är standardströmmarna i Linux?
How many and what are the default streams in Linux?
3st, Stream0: Standard input, Stream1: Standard output och Stream2: Standard error
Hur gör du för att radera flera filer (exempelvis “fil1”, “fil2, och “fil3”) på en gång?
How do you delete multiple files (such as “file1”, “file2,” and “file3”) at once?
Använd: rm fil1 fil2 fil3
Om du använder touch-kommandot på en fil som redan existerar, vad händer då?
The contents of the file remain the same, only the time stamp of the file changes
Vad innebär termen globbing?
Globbing är att använda wildcards.
Vad innebär grep -v ?
grip “reverse” - shows lines that do not contain text
Vad är emacs?
Emacs is one of the more advanced editors. Most often used by developers.
Vilket krypteringssystem använder ssh-nycklar?
RSA
Vilket option måste du använda i “wc” för att endast visa antalet ord?
Which option do you have to use in the “wc” to display only the number of words?
-w
Hur många rader i en fil visar head-kommandot per default?
10 lines
Vilket kommando med vilken option är användbart för att följa en loggfil som kontinuerligt uppdateras?
The “tail” command with option “-f”
Vad är skillnaden mellan who-kommandot och whoami-kommandot?
who shows all logged in users right now. whoami only shows which user you are currently logged in to.
Vad gör en pipe?
Connects one program’s stdout to another program’s stdin
Vad gör följande rad?
cat ~/Testfil | grep e | sort > Sorterad-testfil
Selects rows with the letter e in “Test File” to a new file named “Sorted-Test File”.
Du har en sträng med mellanslag mellan orden där du vill filtrera ut ett specifikt fält. Vilket kommando är lämpligt i detta fallet?. You have a string with spaces between the words where you want to filter out a specific field. Which command is appropriate in this case?
cut -d ‘ ‘ -f, followed by the number of the field you want to filter out.
Var hittar du användardatabasen?
In: /etc/passwd
Är det lämpligt att alltid vara inloggad som root?
No, you should think about running sudo with your command instead of logging in as root.
I vilken ordning listas de tre uppsättningarna av rättigheter för en fil?
In what order are the three sets of permissions for a file listed?
“r”ead “w”rite e”x”ecute, “r”ead “w”rite e”x”ecute, rwx.
Vad innebär det att sätta write-rättigheter för ugo på en katalog?
You give all users the right to create / delete files in the directory.
Vad gör nedanstående rad?
chmod 550 filnamn
The line gives the file Read + Execute permissions for user and group, but no permissions for others.
Vilket kommando med vilken option ger user, group och others både read + write-rättigheter till filen fil1.txt ?
chmod 666 fil1.txt
chmod ugo+rw fil1.txt
Vad är ett alternativt sätt att skriva “chmod 444 filnamn”?
chmod ugo +r
Vilket kommando använder du för att modifiera vilken grupp en fil tillhör? (belongs to?)
chgrp groupname filename
or
chown user: group filename
NOTE.
sudo required
Vilken option använder du med kommandot ls för att lista en fils inode?
ls -i
Vad händer om du raderar alla hårda länkar till en inode men behåller mjuka länkar?
The file is deleted. Only hard links lead to an inode. The soft links only refer to a hard link. A soft link does not directly refer to an inode.
I filen passwd, vilket fält är användarens ID?
3rd field
Vilket uid har root?
0
Var är användarnas lösenord lagrade?
Where are users’ passwords stored?
/etc/shadow
Vilket kopieringskommando använder SSH som bärare?
Which copy command does SSH use as a carrier?
scp (secure copy)
Hur refererar du till en variabel?
$VARIABELNAMN/${VARIABELNAMN}
Vad är miljövariabler?
Environmental variables are system-wide variables that can be used to change the way the operating system works.
Vad innehåller miljövariablen PATH?
PATH contains the absolute paths that the shell uses to search for files in.
Vilket kommando kan du använda för att leta upp var i PATH som skalet hittar en fil?
Using the “which” command
Vad gör Command substitution?
You replace a variable with stdout from another command.
Y = $ (echo “ost”)
echo $ (date) $ Y = 2020 … ost
Vilken typ av programmeringsspråk är skriptspråket bashscript?
bashscript is an interpretive language, i.e. it can be run on any platform that has bash installed.
Disadvantages of this are that it is slower than a compiled programming language.
Vad innebär begreppet shebang och hur skrivs en korrekt bash-shebang?
What does the term shebang mean and how is a correct bash-shebang written?
Shebang is a line that tells the system which interpreter to use. This is because different programming languages have different syntaxes.
A correct bash-shebang is written: #! / bin / bash
Vad är en exit code och vad används den till?
Exit code is a value (0-255) that a program or script can leave when it quits
Exit code is often used to signal to calling programs that, for example, a script “went well or badly”.
Hur tar du reda på ett nyss avslutat scripts exit code?
Using the variable $?
Vad gör kommandot ps?
Gives you an overview of the processes that are active in your system.
Tip: With “ps -aux” you can see all the processes that are active.
Det finns tre olika sätt att lista kommandon efter varandra. Hur ser dessa ut?
command1; command2; command3
command1 && command2 && command3
command1 || command2 || command3
Hur fungerar det när du separerar kommandon med semikolon?
Commands that are separated by a semicolon are run after the previous one, regardless of whether the command before was successful or not.
Hur fungerar det när du separerar kommandon med dubbla och-tecken (&&)? (and-lista)
Commands that are separated by double && run after the previous ONLY if the command before was successful (exit code 0).
The opposite of using double pipe characters, ||.
Hur fungerar det när du separerar kommandon med dubbla pipe-tecken (||)?
(or-lista)
Commands separated by double || runs after the previous ONLY if the command before NOT succeeded.
The opposite of using double-and-characters, &&.
Vilket kommando används för att döda en process med ett specifikt PID (Process ID)?
kill 1234 (där 1234 ersätts med PID-nummer)
Beskriv systemd
systemd is a system and service manager. It serves as a replacement for the traditional init process.
systemd keeps track of background processes (daemons) and handles logging. Modern variant of “service”.
Vilket tecken kan du använda för att starta ett kommando i bakgrunden och direkt återgå till prompten.
&
Vilken är den vanligaste pakethanteraren för RedHat-baserade linux distributioner?
What is the most common package manager for RedHat-based linux distributions?
Yum
Hur gör du för att avinstallera ett paket i ubuntu?
Command: apt remove package name
Vad betyder följande: apt-cache search paketnamn?
You search the local cache of available packages.
To update it, use “apt update”.
Hur gör du när du vill redirecta output direkt till linux “papperskorg”?
Redirect to / dev / null.
Vad innebär Local Port Forwarding?
The connection from a local SSH client is forwarded via a local SSH server to the destination server.
Vad innebär Dynamic Port Forwarding?
The connection from programs is forwarded via a local SSH client to a local SSH server. Then on to one or more destination servers.
Vad är syntaxen för local port forwarding?
ssh -L port1:remoteip:port2 user@host
Beskriv skillnaden mellan lossy och lossless-komprimering
Lossy does not allow you to recreate a file in its full form, as some data is deleted to save space. (Often used for audio and video)
Lossless allows you to completely recover a file, without losing data. (Is less efficient when it comes to saving space)
Förklara följande kommando: tar -xf fil.tar
tar (tape archive) is used in this case to extract the uncompressed tar archive in the current directory.
Vilket kommando med vilken option används för att skapa ett komprimerat tar-arkiv med namnet file.tar?
tar -czf fil.tar *
do not forget -z, the option for the compression itself
Vad är fördelen med att använda rsync vid backuper över internet jämfört med exempelvis scp?
rsync does not transfer files that are already at the destination, i.e. saves bandwidth.
This enables differential backup.
Vad är skillnaden mellan inkrementell kontra differentiell backup?
A differential backup backs up all files that have been modified on a system since the last time a FULL backup was performed.
An incremental backup backs up all files that have changed on a system since the last time a backup was run. The latest backup can be of ANY type.
Du skriver in rsync -avz, vad betyder optionerna?
- a means that the transfer must take place recursively, with timestamps and rights preserved.
- v means that the file being transferred is displayed and sums up when the transfer is complete.
- z compresses the files being transferred, which facilitates slow internet connection.
Du överför filer med rsync, men du får ingen information om överföringen lyckades. Varför?
You are uploading files using rsync, but you will not get any information if the transfer was successful. Why?
rsync works by default in the background. You must use option -v (verbose) to get information about which files are being transferred and a summary when the transfer is complete.
Bibehåller rsync -a hårda länkar vid överföring?
Does rsync -a retain hard links during transmission?
No, you must use the -H option to maintain hard links after a transfer.
Vad är en daemon?
A program that works in the background with a service instead of under the direct control of the user.
Hur gör du för att söka i kataloger + underkataloger med hjälp av ls kommandot?
ls -lR
Hint: combine this with “grabbed filename” to search for a specific file
Varför är kommandot locate så snabbt på att söka igenom systemet?
This is because locate uses a complete indexing of the system in a database.
To update this database use: updatedb.
Var finner du konfigurationsfilen för cron och hur redigerar du den?
In: / etc / crontab
Editing is done with crontab -e
Vad innebär respektive fält separerat av mellanslag i crontabfilen?
Minute Hour Day Month Weekday
Hur ofta kontrollerar crond crontab-filen?
En gång varje minut. (Once every minute.)
Vad innebär följande i en crontab-fil?
0 0 * * * *
Run once every day at midnight.
Vad innebär följande i en crontab-fil?
1-59/2 * 3-6 * *
Run once every two minutes on the 3-6th day of each month.
Vad innebär följande i en crontab-fil?
0 0 * 7-8 1-5
Run once at midnight every Monday to Friday in July and August.
Vad har dessa fem filer gemensamt?
syslogd, telnetd, pptpd, inetd, bootlogd
They are all daemons. I.e. that they run silently in the background.
Kommer ordet “Jimmy” skrivas ut på skärmen?
#!/bin/bash MITTNUMMER=100 if [ $MITTNUMMER -eq 200 ] then echo "Jimmy" fi
No!
Since the number 200 is not equal to 100, “Jimmy” will not be printed on the screen.
Vilken option behöver du till file-kommandot för att leta efter filer som skapats de senaste 15 minuterna?
-mmin 15
Vilken option behöver du till file-kommandot för att leta efter filer som använts de senaste 40 minuterna?
-amin 40
Vad gör följande kommando?
find FILNAMN -mtime -30
Searching for files that have been modified in the last 30 days.
(Hint: To search for files modified MORE than 30 days ago, use +30 instead.)
Vad gör följande kommando?
find . -size -1G
Looking for files in the current directory and subdirectories that are less than 1 GB in size.
Hur använder du find-kommandot för att hitta filer med en specifik filrättighet?
Use the “-perm xxx” option, where xxx is replaced with the right.
Vad gör optionen -exec i find-kommandot?
Allows you to run a command on the file you are looking for.
For example, useful for searching for a script and then running it directly.
Hur skapar du ett nytt alias i bash?
alias alias name = command is used to create a new alias.
For example: alias l = “ls -la”
Var kan du spara ett alias för att göra det permanent?
I ~ / .profile. ????preguntar!
or ~ / .bashrc
or ~ / .bash_aliases
Vad ska du skriva för att lista storleken på alla filer, rekursivt från där du står, i mänskligt läsbart format?
What should you write to list the size of all files, recursively from where you stand, in human readable format?
du -h
Vad gör df -h?
Displays used and free file space per file system in readable format.
Vad heter den första hårddisken på ett system?
/dev/sda
Vad gör lsblk?
Lists system disks.
Hur många rootpartitioner går det att ha i ett system?
Always just one. Other partitions are mounted under the root partition.
Är det möjligt att mounta partitioner som vanlig användare?
No, only root can mount partitions. For example, some distributions automatically mount USB devices as root.
Vilket filsystem är standard på ett nytt linuxsystem?
Ext4
Vad använder systemet en swappartition till?
It is used by kernel as virtual memory if RAM runs out.
Vilket program kan användas för att partionera en ny disk?
fdisk
eller cfdisk, cgdisk, gparted, gdisk osv
Vad betyder följande?
mkfs -t /dev/sdb1
Partition the disk sdb1 with the system’s default file format.
Hur fungerar umask?
umask automatically removes directory and file permissions from the default settings (666 for files) (777 for directories) to create actual permissions.
Var sätts default umask i ubuntu?
In: /etc/login.defs
Hur gör du för att modifiera execute-rättigheter på en fil med umask?
You do not. umask cannot change the permissions on a file.
Vilken umask ger rw-r–r– ? (När det gäller en fil)
022
666 - 022 = 644
Vilka rättigheter tar umasken 222 bort på en fil?
All write permissions on a file.
666 - 222 = 444 r - r - r–
Vilka rättigheter tar umasken 666 bort på en katalog?
All but execute permissions.
(777 - 666 = 111) –x - x - x
Vad står PAM för?
Pluggable Authentication Module
A modular authentication system
Vad hittar du i /etc/security/pwquality.conf?
A file to configure the default password quality for system passwords.
This file is read by the libpwquality library and the tools that use this library to control and generate passwords.
Vad gör denna rad?
tr [a-z] [A-Z]
Translates lowercase letters into uppercase using tr (translate).
Vad är awk?
A word processor with its own programming language and syntax.
Förklara hur du med sed (Stream EDitor) ändrar i denna textfil:
sed ‘s/unix/linux/’ linus.txt
You replace the first word in a line beginning with “unix” with “linux” in the file “linus.txt”.
To replace all words (not just the first), use ‘s / unix / linux / g’
Hur gör du för att endast skriva ut rad nummer 7 i en fil med sed?
sed -n 7p
Vilket kommando används för att temporärt logga in som root?
su
Vilket kommando ska användas för att editera /etc/sudoers?
visudo
Hur fungerar denna syntaxen i /etc/sudoers?
root ALL=(ALL) ALL
the root user can be activated from all terminals, act as all users, and execute all commands.
Vad har jimmy rättigheter till att göra här?
jimmy ALL=(ALL)
Jimmy can log in from all terminals and act as root, but only using the sudo command
Vad har jimmy rättigheter till att göra här?
jimmy ALL= /sbin/poweroff
Jimmy has the right, from all terminals, to run a specific command. In this case, poweroff.
Hur ser syntaxen ut för /etc/sudoers?
user host = (user(s)) command
Vad är NFS?
Network File System.
A protocol for sharing files and directories with clients over a network.
Vad gör detta kommando?
exportfs -r
The NFS server reads the changes you made in the configuration file.
Var hittar du filen som styr vilka ip-adresser som har tillgång till en nfs-server?
In: /etc/exports
Vilken regex skriver du för att matcha följande rader?
Match: $t.xw
Skip: 3z45
Match: w.345
.
Without a backslash, a point matches all characters.
Vilken regex skriver du för att matcha följande rader?
Match can
Match man
Skip dan
Skip pan
Either ‘[cm] an’ or ‘[^ dp] an’
Vilken regex skriver du för att sortera ut ord där bokstaven “o” förekommer EXAKT tre gånger i rad?
o{3}
Vilken regex skriver du för att sortera ut ord där bokstaven “f” förekommer flera gånger i rad?
[f]+
Vad betyder denna regex?
\d
Optional number.
Vad betyder denna regex?
^
Matches the beginning of the line
Hur ska du skriva en regex för att matcha en tom rad?
^\s*$
Hur gör du för att matcha ett mellanslag?
\ s {1} = Matches 1 whitespace.
‘’ = Also works.
Vilken regex skriver du för att matcha rad 1, men inte rad 2?
- Jimmy - Linuxexpert
- Jimmy - Linuxexpert & Ciscoexpert
Jimmy - Linuxexpert$
Nämn två kommandon med optioner som möjliggör det att sätta ett expiration date på ett användarkonto.
usermod -e 2020-xx-xx users
chage -E 2020-xx-xx users
Vad gör kommandot chage?
Manages periodic password changes and time limitation of user accounts.
Vad får du fram för information här?
chage -l jimmy
Information about time limits for passwords and access to the “jimmy” account.
Vad står HIDS för?
Host Intrusion Detection System
Vilket program kan användas till att skydda mot brute-force attacker?
fail2ban
Vilken av följande filer ska användas för att konfigurera fail2ban?
- /etc/fail2ban/jail.conf
- /etc/fail2ban/jail.local
- /etc/fail2ban/jail.d/f2bconf.local
- /etc/fail2ban/jail.local
I filen /etc/fail2ban/jail.local, vad innebär det att maxretry är ställt till värdet 3?
This means that the person trying to log in has three attempts within findtime before the person is banned.
Fail2ban använder sig av så kallade “jails” Vad är ett jail?
A jail describes a service and contains filters and actions. Log degrees that match the search pattern are counted and when a predefined condition is met, corresponding measures are performed.
Vad är systemctl?
A command to manage systemd. Used to, for example, start / restart / shut down services (daemons) or to see the status of a service.
Vad betyder IPS?
Intrusion Prevention System
På vilket sätt fungerar fail2ban även som ett Intrusion Prevention System?
fail2ban can apply iptables rules.
ufw är frontend för iptables. Vad gör programmet?
UFW (Uncomplicated Firewall) is a program for managing a net filter firewall that is designed to be easy to use.
UFW uses iptables for configuration and is standard in ubuntu.
Hur många tabeller finns det default i iptables?
3 pieces: MANGLE, FILTER and NAT
I iptables, vad konfigureras i tabellen MANGLE?
MANGLE handles QoS (Quality of Service), for example how traffic should be prioritized.
Vad heter tabellen i iptables som hanterar trafikfiltering?
FILTER
NAT-tabellen i iptables har två stycken “chains”. Vad heter dessa och vad hanterar respektive chain?
Prerouting and Postrouting.
Prerouting handles traffic where the destination address is translated. Post-routing handles traffic where the source address is translated.
FILTER tabellen i iptables har 3 st chains. Vilka är dessa?
INPUT - Traffic to the Linux device.
FORWARD - Traffic passing THROUGH the Linux device (routing).
OUTPUT - Traffic coming from the Linux device
Detta kommando listar aktuell iptables-konfiguration:
(sudo) iptables -L
Vad är defaultinställningen i en iptables-kedja?
policy ACCEPT (In cisco terms “permit any”)
Vad betyder följande rad?
iptables -A INPUT -p icmp -j DROP
Traffic to the device belonging to the icmp protocol should not be allowed and dropped without response to the transmitter.
Här droppas tcp-trafik på port 22 från 10.0.0.123/24. Hur gör du för att lägga till detta i loggen?
iptables -A INPUT -p tcp –dport 22 -s 10.0.0.123/24 -j DROP
You add “-j LOG” after the ip address on the line before.
Example:
iptables -A INPUT -p tcp –dport 22 -s 10.0.0.3/32 -j LOG
iptables -A INPUT -p tcp –dport 22 -s 10.0.0.123/24 -j DROP
Vad gör “-j RESET” i slutet av en rad i iptables?
DOES NOT allow traffic, but responds to the sender with an icmp stating that traffic is not allowed.
Vilken jump action vill du ha i slutet av en rad i en iptables-kedja för att tillåta trafiken?
ACCEPT
Vad är extended file attributes?
Extended file attributes are file system functions that allow users to associate computer files with metadata that is not interpreted by the file system, while common attributes have a purpose that is strictly defined by the file system.
Vad gör kommandot lsattr?
Lists extended file attributes.
Vilken kommando används för att ändra extended file attributes?
chattr
Vad innebär kommandot “chattr +a filnamn” ?
The file is given the attribute “append”. That is, it will only be possible to add information to the file, never delete data in the file.
Vad innebär kommandot “chattr +i filnamn” ?
The file is given the attribute “immutable”. That is, it is not possible to delete, add, change, move the file, etc.
In other words, the file is frozen and unchanged where it is.
Är det möjligt att redigera extended file attributes på filer i ett exfat eller fat32-filsystem?
No, only specific file systems support extended attributes. For example NTFS, APFS and ext4.
Vad är skillnaden mellan dessa två rader?
- rwSrw-r–
- rwsrw-r–
The top line does not have execute rights for the user, but has special permission.
On the bottom line there are execute rights AND special leave.
Vad innebär SUID (Set User ID)?
SUID is a special state assigned to a file. These permissions allow the file being run to run with the owner’s permission.
If a file was owned by the root user and has the setuid bit set (regardless of who ran the file), it would always run with root user permissions.
Hur sätter du SUID (Set Group ID) på en fil?
With “chmod u + s” or “chmod 4000”
Hur fungerar det när SGID (Set Group ID) är tilldelat en fil?
When Set Group ID is assigned, it is run with the group permission.
For example, if a file was owned by the user group, it would always run with the permission of the user group, regardless of who ran the file.
Hur använder du chmod för att sätta SGID (Set Group ID) på en fil?
chmod g+s
eller
chmod 2000
Hur fungerar SGID för kataloger?
När setgid-biten är inställd på en katalog ärver alla filer som skapas i katalogen gruppägarskapet för den katalogen.
Vad är sticky bit på en katalog?
When sticky is set to a directory, only the root user, the directory owner and the file owner can delete files in that directory.
Hur sätter du endast sticky på en katalog med chmod?
chmod o+t
eller
chmod 1000
Du ska använda chmod för att sätta följande rättigheter med oktala systemet på filen “jimmytext”:
Read för User,Group,Others
Sticky.
Vad skriver du in?
chmod 1444 jimmytext
Du ska använda chmod för att sätta följande rättigheter med oktala systemet på filen “jimmytext”:
Read för User,Group,Others.
Write för User och Group.
SUID
Vad skriver du in?
chmod 4664 jimmytext
Vad är auditd?
A monitoring service for Linux that can be used to log system calls, file changes, etc.
Hur bygger du en databas över systemet i tripwire?
tripwire –init
Hur gör du för att kontrollera systemet i tripwire utifrån din databas?
tripwire –check
Detta program är är ett verktyg för integritetscheck av filsystem.
Tripwire
Beskriv hur tripwire fungerar kortfattat.
Tripwire uses a policy and a database. The policy is the configuration files that define which files and directories are to be monitored and how.
The database is built based on what the system’s files look like at a given time. When an integrity check is run, the files in the system are compared with what they looked like before according to the database.
Du vill konfigurera så att alla systemhändelser loggas till en remote syslog-server. Vilken fil ska du ändra i?
/etc/rsyslog.conf
Vad används Syslog-protokollet till?
The syslog protocol is used to log system events.
Var hittar du alla sysloghändelser?
I /var/log/syslog.
Är det säkert att skicka syslog-data till ett annat nät?
No, not without further action. syslog is unencrypted.
Hur många severity-levels finns det i syslog?
8 stycken. 0 - 7.
Vilken är den allvarligaste severity-leveln i syslog?
Level 0, Emergencies.
Vad är innebär facility i syslog?
Service identifiers, i.e. which part of the system is the sender.
Vad heter kernelfunktionen som möjliggör användandet av iptables? (obs, små bokstäver!)
What is the name of the kernel function that enables the use of iptables? (note, lowercase letters!)
netfilter
script2 körs bara om script1 avslutas med exitlevel 0
script1 && script2
komando ‘script.sh 1>fil’ skickar scriptets standar error till fil
Nej
echo “ej” >fil; In fil fil1; In fil fil2;cat fil1 fil2; #Vad kommer att skrivas ut på skärmen?
hejhej
Vems lösenord ska anges här? Nisse Kör kommandot su -
Whose password should be entered here? Nisse Run the command su -
root’s password
Det finns en enda fil på Bettan som ägs av användaren “games”. Vilken är filen? Svara med absolut sökväg
There is only one file on Bettan that is owned by the user “games”. What is the file? Answer with absolute path
cecilia@bettan:~$ find / -user games 2> /dev/null or
cecilia@bettan:~$find / -user 5 2> /dev/null
/var/lib/php/modules/justafile
Vilket är tredje ordet på rad 901 i filen /home/jimmy/hhgttg.txt?
cecilia@bettan:/home/jimmy$ cat hhgttg.txt | head -901
The correct answer is: phrase
Vems lösenord ska anges här? Nisse kör kommandot sudo passwd
Whose password should be entered here? Nisse runs the command sudo passwd
Nisse’s
Du vill lista filers extended attribut. Vilket kommandon använder du? (obs bara kommandot. Inga optioner/parametrar)
You want to list files extended attributes. What commands do you use? (note only the command. No options / parameters)
lsattr
Hur mycket ledigt utrymme finns på Bettans /-partition? Svara med antalet jämna Gigabytes.
How much free space is there on the Bettans / partition? Answer by the number of even Gigabytes.
cecilia@bettan:~$ df -h
15 gb
Det finns enda fil på Bettan som har rättigheter
“-r-x-wx-w-“ (output från ls -l). Vad heter filen? Absolut sökväg!
cecilia@bettan:~$ find / -perm 532 2> /dev/null
/Correct answer: usr/share/mime/README
På Bettan, vad heter gruppen med gid 1043?
cecilia@bettan:~$ cat /etc/group | grep 1043
Correct answer: newgroup2
På Bettan, i filen /home/jimmy/hhgttg.txt, hur många rader finns det som innehåller antingen “think” eller “thank”?
cecilia@bettan:~$ cat /home/jimmy/hhgttg.txt | grep “th[ia]nk” | wc -l
Correct answer: 100
På Bettan, i filen /etc/ssh/ssh_config, hur många rader finns det i filen om du inte räknar med tomrader och kommentarer?
cecilia@bettan:~$ cat /etc/ssh/sshd_config | grep -v ‘^#’ | grep -v ‘^$’ | wc -l
Correct answer was 32