Question

In: Computer Science

When logged in as the root user, how often would you do the command rm -rf...

When logged in as the root user, how often would you do the command rm -rf / ?

Solutions

Expert Solution

How often you can get, it's basically depend on the specific Unix/Linux distributions.

- rm command would be removed with it as well as any other standard command in /bin and other folders.

Here is the simple test which I've performed in Linux Ubuntu 15.04 using VM.

  1. Initialize virtual machine via vagrant:

    vagrant init ubuntu/vivid64 && vagrant up --provider virtualbox && vagrant ssh 
  2. Then when you're trying to remove all the files in the standard way, it doesn't let you:

    vagrant@vagrant-ubuntu-vivid-64:~$ sudo rm -fr / rm: it is dangerous to operate recursively on '/' rm: use --no-preserve-root to override this failsafe 
  3. So lets try --no-preserve-root. Always double check you're logged in virtual machine (so you're having vagrant@vagrant-ubuntu-vivid-64:~$), then run (don't try that at home):

    vagrant@vagrant-ubuntu-vivid-64:~$ sudo rm -vfr --no-preserve-root / removed directory: '/lost+found' removed directory: '/opt' removed '/bin/nc' removed '/bin/less' removed '/bin/wdctl' removed '/bin/nano' ... removed '/bin/rmdir' removed '/bin/sh' removed '/bin/rm' ... removed directory: '/bin' removed directory: '/usr/games' removed '/usr/bin/byobu-launcher-install' removed '/usr/bin/ipcmk' removed '/usr/bin/sum' removed directory: '/usr/bin' removed '/usr/lib/gcc/x86_64-linux-gnu/4.9.2' removed '/usr/lib/gcc/x86_64-linux-gnu/5.0.1' removed directory: '/usr/lib/gcc/x86_64-linux-gnu/5' removed '/usr/lib/gcc/x86_64-linux-gnu/4.9/libquadmath.so' removed '/usr/lib/gcc/x86_64-linux-gnu/4.9/libgomp.so' ... removed directory: '/run/initramfs' removed directory: '/media' rm: cannot remove '/proc/fb': Operation not permitted rm: cannot remove '/proc/fs/ext4/sda1/options': Operation not permitted ... removed '/vmlinuz' removed '/boot/config-3.19.0-23-generic' removed '/boot/grub/grubenv' ... removed directory: '/boot' removed '/lib64/ld-linux-x86-64.so.2' rm: cannot remove '/dev/hugepages': Device or resource busy rm: cannot remove '/dev/mqueue': Device or resource busy rm: cannot remove '/dev/shm': Device or resource busy removed '/dev/vcsa7' ... removed '/dev/mem' removed '/dev/rfkill' removed '/dev/vga_arbiter' ... rm: cannot remove '/sys/fs/ecryptfs/version': Operation not permitted removed directory: '/etc' removed directory: '/mnt' removed '/vagrant/.vagrant/machines/default/virtualbox/action_provision' removed '/vagrant/.vagrant/machines/default/virtualbox/action_set_name' removed '/vagrant/.vagrant/machines/default/virtualbox/creator_uid' removed '/vagrant/.vagrant/machines/default/virtualbox/id' removed '/vagrant/.vagrant/machines/default/virtualbox/index_uuid' removed '/vagrant/.vagrant/machines/default/virtualbox/private_key' removed '/vagrant/.vagrant/machines/default/virtualbox/synced_folders' removed directory: '/vagrant/.vagrant/machines/default/virtualbox' removed directory: '/vagrant/.vagrant/machines/default' removed directory: '/vagrant/.vagrant/machines' removed directory: '/vagrant/.vagrant' removed '/vagrant/Vagrantfile' rm: cannot remove '/vagrant': Device or resource busy 

    After that it gets back to the shell prompt like nothing just happened, but you can't execute any commands anymore apart of few built in and kill, so you can finish your job and kill your session:)

    For example:

    $ rm rm: command not found $ kill kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec] $ which kill -bash: /usr/bin/which: No such file or directory $ kill -9 $$ Connection to 127.0.0.1 closed. 

So it pretty removed everything, including rm, ls and all other commands, but still you're logged-in. There are some special folders which weren't removed such as some devices from /dev, /proc or /sys which are aren't regular directories/files, but it's pseudo-filesystem providing interfaces to process and kernel data.


Related Solutions

linux: Become the root user for this exercise. What command did you use to do this...
linux: Become the root user for this exercise. What command did you use to do this again? $ Now that you are root, create a new user on your system called labsevenuser. What is the command you used to create this user? # Set a new password for the new user you just created in step 2 above. What is the command you used to do this? # Create a new group called awesomepeople. Add the user you created in...
linux: Become the root user for this exercise. What command did you use to do this...
linux: Become the root user for this exercise. What command did you use to do this again? $ Now that you are root, create a new user on your system called labsevenuser. What is the command you used to create this user? # Set a new password for the new user you just created in step 2 above. What is the command you used to do this? # Create a new group called awesomepeople. Add the user you created in...
For the following commands you must be logged in as user “system”. You will need to...
For the following commands you must be logged in as user “system”. You will need to do some research on the commands CREATE USER; GRANT CREATE SESSION; GRANT CREATE…..; GRANT ALTER …., GRANT SELECT….; REVOKE ……; and EXECUTE ….. 5. Create two database users:  The first is a concatenation of your first and last name (e.g. johndoe).  The second is a concatenation of your instructors first and last name (e.g. sallysmith) 6. Assign the two users privileges to...
1. In terms of security, why would you not use rm command to delete files? 2....
1. In terms of security, why would you not use rm command to delete files? 2. Shred and dd are tools used to securely delete files. Which is the best tool for securely deleting a file from a system and why? Consider the limitations of each tool when choosing your answer. 3. What encryption is used to encrypt HTTP traffic (HTTPS)? 4. The CIA triad , confidentiality, integrity, and availability represent the three goals for cybersecurity. Which goal(s) does/do encryption...
CAPM potpourri Can you re- define the CAPM mode as:                                E(Ri) – Rf = [E(Rm)
CAPM potpourri Can you re- define the CAPM mode as:                                E(Ri) – Rf = [E(Rm) - Rf]                 a. Yes or not? Why? Studies have found that Beta is not the only factor that matters for determining the expected return on a stock a. Mention 3 other factors that impact the expected return of the stock and how they could affect      it. Explain thoroughly Why Beta was declared “dead” after the market crash of 1987? a. Explain what...
3) Write the awk command that would show the user wmorales (or yourself) that is online...
3) Write the awk command that would show the user wmorales (or yourself) that is online (you have to use a pipe) Output, depending on the system that you are using or the command to find the users online, but it would be similar to: wmorales pts/37 10.32.9.93 13:58 1.00s 0.15s 0.10s w or wmorales pts/8 2020-04-25 12:22 (c-71-59-237-122.hsd1.or.comcast.net) YOUR AWK COMMAND: (10 points hard one) - 4) use who to show the the users on our system that have...
How do you schedule a Servlet to run, from an HTML file, when the User clicks...
How do you schedule a Servlet to run, from an HTML file, when the User clicks on the Submit button? Show html code here
How do you identify C.S. of monocot root from monocot shoot? Similarly, how do you differentiate...
How do you identify C.S. of monocot root from monocot shoot? Similarly, how do you differentiate dicot root from dicot shoot?
IN EXCEL PLEASE!!! Thank you! E(rM) 7.50% rf 3.00% Stock price 53.92 Stock beta, bE 0.72...
IN EXCEL PLEASE!!! Thank you! E(rM) 7.50% rf 3.00% Stock price 53.92 Stock beta, bE 0.72 Cost of debt 6.22% Percentage of equity 75.70% Percentage of debt 24.30% Boeing's tax rate, TC 24.96% Boeing's debt beta, bD Boeing's asset beta Boeing's WACC
How would you rate your political skills, and which political behavior do you use most often?...
How would you rate your political skills, and which political behavior do you use most often? How will you change and develop your political skills? How would you evaluate your networking skills? What will you do differently in the future to improve your networking skills?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT