Usually users that have the ability to run commands as root need to do this through the use of a program like sudo
. Running commands as root that do not need to be run as root can be very dangerous as root has the ability to do manage system files, install/uninstall packages, access (hashed) user passwords in /etc/shadow
, and do virtually everything on a system. However, root is not "deleted", as you say, but access is disabled, possibly through ssh via the PermitRootLogin
option.
In addition, if there is an exploit in a piece of software you are running that allows, say, a remote shell to be accessed on your computer. If it you were running as root, it would be able to do anything on your computer with no restrictions. But as a normal user, it wouldn't be able to do anything, as sudo
by default requires a password to be able to run a command as root.
Some safeguards are in place to prevent you from totally destroying your computer involuntarily, such as rm -rf /
requiring --no-preserve-root
. But these are not foolproof measures, and if you were running as root and accidentally changed to the /
directory and ran rm -rf *
, you would be in trouble. While on the other hand, user accounts typically only have write access to their home folders, giving you time to exit the command and keep your files.