{"id":7614,"date":"2024-01-13T17:18:37","date_gmt":"2024-01-13T11:48:37","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=7614"},"modified":"2024-01-13T17:18:44","modified_gmt":"2024-01-13T11:48:44","slug":"how-to-set-up-the-entire-filesystem-or-a-specific-partition-read-only-on-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/how-to-set-up-the-entire-filesystem-or-a-specific-partition-read-only-on-ubuntu-20-04\/","title":{"rendered":"How to set up the entire filesystem or a specific partition read-only on Ubuntu 20.04?"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\">Introduction:<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Making the entire filesystem or a specific partition read-only on Ubuntu 20.04 can be a useful security measure or a precautionary step to prevent unintended modifications. The read-only setting ensures that no write operations can be performed on the designated filesystem, safeguarding its integrity and reducing the risk of accidental data loss or unauthorized changes. This process involves modifying the <code>\/etc\/fstab<\/code> file, which holds crucial information about disk drives and partitions.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Step 1:<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Open the <code>\/etc\/fstab<\/code> file using a text editor.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>$sudo nano \/etc\/fstab<br>                or<br>$sudo vi \/etc\/fstab<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\">Step 2:<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Identify the line corresponding to the filesystem or partition we want to make read-only. It typically contains information such as device, mount point, filesystem type, and other options.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Step 3:<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Add the <code>ro<\/code> (read-only) option to the list of mount options. Place it after other options, separated by commas.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>\/dev\/sda1 \/ ext4 errors=remount-ro,ro 0 1<\/td><\/tr><\/tbody><\/table><figcaption class=\"wp-element-caption\">    <br>Note: Replace <code>\/dev\/sda1<\/code>, <code>\/<\/code>, and <code>ext4<\/code> with your actual device, mount point, and filesystem type.<\/figcaption><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\">Step 4:<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Save the changes made to the <code>\/etc\/fstab<\/code> file and exit the text editor.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Step 5:<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Remount the filesystem to apply the changes.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>$ sudo mount -o remount \/<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\">Conclusion:<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Configuring a filesystem or partition as read-only provides an added layer of protection against accidental modifications or unauthorized write operations. When making the root filesystem read-only, it is essential to carefully consider the implications.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction: Making the entire filesystem or a specific partition read-only on Ubuntu 20.04 can be a useful security measure or [&hellip;]<\/p>\n","protected":false},"author":496,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1022],"tags":[],"class_list":["post-7614","post","type-post","status-publish","format-standard","hentry","category-web-architecture","psol-cat-web-architecture"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-1YO","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/7614","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/496"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=7614"}],"version-history":[{"count":0,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/7614\/revisions"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=7614"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=7614"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=7614"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}