I know that sudo can do some bad things - there are warnings everywhere:
But I'm interested as to what is likely to happen when using sudo - why is it so dangerous, and what can I do to reduce that danger?
elementary OS Stack Exchange is a question and answer site for developers and users of elementary OS and applications. It only takes a minute to sign up.Sign up to join this community
sudo is running the following command with super user (root) privileges. That's basically the "administrator" you might know from other platforms. But why is this dangerous? Because with super user privileges, everything can be done on your system (as it has access to all files and your system's whole functionality). Remove every single package on your system? Check. Delete every file on your system? Check. Install spyware? Check. Everything is possible. And that's potentially dangerous after all. Running one unknown
bash script might compromise your system.
The most blatant answer is: Common sense and responsible behavior. You cannot restrict
sudo's abilities. When you run
sudo, you have to be fully aware of what you're doing - Your system won't stop you, as it deems your input trustworthy and intended.
The message you see above is not there to annoy you as a user, it's there to stop you for a second and think What am I doing here? - A lot of commands you can find online are either outdated or might cause problems. After all, blogs are main sources for how-to instructions, but they were written from a limited view and can be wrong. They could be written with malicious intents as well - You should never trust a random forums post.
Therefore you have to be independent of people telling you what to do. Scrutinize the post - Learn about commands involved: What does this command do? What does the
-x flag mean? How is this supposed to solve my problem? Is this solution up-to-date?
For example: If a website is asking you to
curl http://link/to/script | sudo bash, don't do that. Download the script, take a quick look, and after that, you can run it. Even if the original author did not intend to make the script malicious, someone might have compromised the original author's accounts and uploaded a new, "updated" script. You are the one responsible for your computer's integrity, and therefore you need to be familiar with your system's capabilities.
Sudo is used to give a normal user the permissions as an administrateur. One of the bad things that might happen to you
/folder, for example
sudo rm -rf /usr
sudo apt-get remove wingpanel* slingshot*
How to reduce the danger
Don't ever copy paste commands from sites/social networks that you don't know or what could remove/install
Learn what each command could do
PS : Please don't try any of those commands.This is may broke something(or everything).