When it comes to competitions, several of the machines the team will be responsible for will running Linux. Often it's older versions of common of Linux distros such as Ubuntu 14.04.
There are very basic commands that will be necessary in order to navigate your machine.
ls- Lists the contents of the current directory. To show all files, usels -al.pwd- Shows your current directorycd- Changes your current directory.cd ~,cd /,cd /etc/mkdir- Makes a new directorymkdir test,mkdir -p a/test/dirrm- Deletes a file (add-rfto delete a directory)find- Find a filelocate- Easy way to find a filetouch- Create an empty filetouch file.txtcat- Print the contents of a file tostdoutgrep- Search a file for a stringgrep 'string' file.cps- Shows running processes --ps auxffor tree structurekill- Kill a processkill -9 $PIDwho- Show who is signed inecho- Print tostdout--echo 'This a test'lsof- See all open file descriptorstail -f- Watch the end of a filewatch- Run a command at specified intervals
There are a few ways to find out what distro you're on, the name of the machine, and the machine's IP address
uname -a- Prints the kernel version and morehostname- Prints the system hostnameifconfig- Shows the IP addressip addr- The new way to show IP addresscat /etc/os-release- Shows various information about the system
There will be certain services that need to be running throughout a
competition. It will be good to know how to manage them. The tool used to
manage services on newer Linux systems is called systemctl, part of the
systemd suite of utilities.
stop- Stops a servicerestart- Restarts a servicestart- Starts a servicestatus- Shows whether a service is running/stopped/failedlist-unit- Shows all services and morereboot- Reboot the machine
Once a malicious actor has had root access on your Linux machine, that machine cannot be trusted. The right thing to do would be to start fresh and be better at prevention in the future. Unfortunately, that's not possible during a competition. Here's a few really nasty ways an attacker could mess with you.
- Adding malicious things to
/etc/crontab. These will run at specified intervals (every minute, 5 minutes, every hour at :05, etc.) - Putting fake binaries on your
$PATHsudoso that anyone who runssudogets rootpasswdso that you can't change passwords or passwords get logged
- malicious systemd services or timers
- modifications to
~/.*rcfiles
man-- tryman man- linuxjourney.com (External link)
- JMU Unix Users Group
--helpflag to commandsaproposto search for commands