>>3Before you do any command that starts with sudo, be aware of what you are doing. A good thing to do is to NEVER type a sudo command by itself, one wrong move could get you in trouble.
On most shells, you can use "!!" to add your previous command to the current one. A common pattern I always use is the following:
$ touch /bin/ls
touch: /bin/ls: Permission denied
$ sudo !!
$ sudo touch /bin/ls
I first type my full command, make sure it is what I need. Then I type "sudo !!" to get the previous command with "sudo" prepended.
>>7I've got some bad news for you... Viruses exist on Linux too and we got tools for them: http://en.wikipedia.org/wiki/Rkhunter
The "you can't get a virus" argument ONLY means that the OS is unlikely to be penetrated remotely and that the softwares you downloads from package managers (apt-get, yum, etc...) are safe from misbehaving code.
But you can still have a virus if you act without thinking. I don't know, why not modify your own sshd_config "just because" and leave the door open for every script kiddie out there?
You can even download a cool shell script that will make coffee for you (actually, I'm thinking about
RVM because their only install process is a fucking curl piped to a shell). Too bad in its two thousands lines was a TINY command: "echo 'ns -kl 3000 | sh' >> /etc/profile".
Next thing you know, I have a FULL SHELL ACCESS to your machine. Good job, I hope your iptables got a DENY ALL somewhere, right? Because I got a "virus" on your machine in TWENTY-TWO characters.
You are only as safe as you are not being stupid. Running unstrusted software is not stupid, it's a risk you have to calculate. However, saying "Linux can't have viruses" is stupid.
The first real lesson of computer security is that YOU ARE NEVER TRULY SECURE. Cool, you sshd only allows one user to log, with a private key, in a jail, with no privileges or possible escalation. Good job!
But I have seen hackers with a setup even more secure get rooted when someone (not from my team but from my school) took root access straight in the memory from a restricted Python Shell (
his write-up only involves him solving the challenge where the sandbox was, not taking over the sandbox).
Oh, and for context: https://ctftime.org/team/3804