{"id":2201,"date":"2017-02-22T13:59:11","date_gmt":"2017-02-22T12:59:11","guid":{"rendered":"http:\/\/monodes.com\/predaelli\/?p=2201"},"modified":"2017-02-22T13:59:11","modified_gmt":"2017-02-22T12:59:11","slug":"how-to-revert-chown-command","status":"publish","type":"post","link":"https:\/\/monodes.com\/predaelli\/2017\/02\/22\/how-to-revert-chown-command\/","title":{"rendered":"How to revert chown command?"},"content":{"rendered":"<p>How easy is to mess up a system with sudo!<\/p>\n<p>From <a href=\"http:\/\/unix.stackexchange.com\/questions\/48845\/how-to-revert-chown-command\">http:\/\/unix.stackexchange.com\/questions\/48845\/how-to-revert-chown-command<\/a><\/p>\n<p>Rpm based distros help a little. I have to check in deb and apt offer something comparable<\/p>\n<p><!--more--><\/p>\n<blockquote>\n<div class=\"post-text\">\n<p>If I run:<\/p>\n<pre><code>sudo chown -R user:user \/\n<\/code><\/pre>\n<p>Can I revert it to what it was before I ran it?<\/p>\n<div class=\"comment-body\"><span class=\"comment-copy\">After <code>sudo chown -R user:user \/<\/code>, it&#8217;s likely that the system is so badly hosed that you <i>can&#8217;t<\/i> restore from a backup.<\/span> \u2013\u00a0<a class=\"comment-user\" title=\"9,042 reputation\" href=\"http:\/\/unix.stackexchange.com\/users\/10454\/keith-thompson\">Keith Thompson<\/a><span class=\"comment-date\" dir=\"ltr\"><a class=\"comment-link\" href=\"http:\/\/unix.stackexchange.com\/questions\/48845\/how-to-revert-chown-command#comment68272_48846\"><span class=\"relativetime-clean\" title=\"2012-09-22 23:59:25Z\">Sep 22 &#8217;12 at 23:59<\/span><\/a><\/span><\/div>\n<\/div>\n<div class=\"comment-body\">\n<div class=\"post-text\">\n<p>If your distro is RPM based, you can restore ONLY files that installed by rpm packages.<\/p>\n<p>To restore all package permissions:<\/p>\n<pre><code>rpm --setperms -a\n<\/code><\/pre>\n<p>To restore all package owner (user\/group):<\/p>\n<pre><code>rpm --setugids -a\n<\/code><\/pre>\n<p>If -a doesn&#8217;t run, you can execute a bash loop:<\/p>\n<p>For permissions:<\/p>\n<pre><code>for x in $(rpm -qa); do rpm --setperms $x; done\n<\/code><\/pre>\n<p>For owner:<\/p>\n<pre><code>for x in $(rpm -qa); do rpm --setugids $x; done\n<\/code><\/pre>\n<p>Extracted from: <a href=\"http:\/\/www.sysadmit.com\/2016\/10\/linux-restaurar-permisos-de-un-paquete.html\" rel=\"nofollow\">http:\/\/www.sysadmit.com\/2016\/10\/linux-restaurar-permisos-de-un-paquete.html<\/a><\/p>\n<\/div>\n<\/div>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p class=\"excerpt\">How easy is to mess up a system with sudo! From http:\/\/unix.stackexchange.com\/questions\/48845\/how-to-revert-chown-command Rpm based distros help a little. I have to check in deb and apt offer something comparable<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"https:\/\/monodes.com\/predaelli\/2017\/02\/22\/how-to-revert-chown-command\/\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1],"tags":[],"class_list":["post-2201","post","type-post","status-publish","format-standard","hentry","category-senza-categoria"],"jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p6daft-zv","jetpack-related-posts":[{"id":1814,"url":"https:\/\/monodes.com\/predaelli\/2016\/10\/21\/sometimes-it-is-annoying\/","url_meta":{"origin":2201,"position":0},"title":"Sometimes it is annoying","author":"Paolo Redaelli","date":"2016-10-21","format":false,"excerpt":"Who? SELinux of course! Mind me, it is a wonderful tool. Tell me I'm old-fashioned, tell me I'm unacknowledged about the security it brings. This after I just wanted to add a theme to my Wordpress inner company blog. SELinux kept saying something like \"I don't think so!\". I ended\u2026","rel":"","context":"In &quot;Fedora - RedHat&quot;","block_context":{"text":"Fedora - RedHat","link":"https:\/\/monodes.com\/predaelli\/category\/fedora-redhat\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":9912,"url":"https:\/\/monodes.com\/predaelli\/2022\/12\/14\/how-to-configure-wireless-wake-on-lan-for-linux-wifi-card\/","url_meta":{"origin":2201,"position":1},"title":"How to configure wireless wake-on-lan for Linux WiFi card","author":"Paolo Redaelli","date":"2022-12-14","format":false,"excerpt":"How to configure wireless wake-on-lan for Linux WiFi card - nixCraft I have Network Attached Storage (NAS) server that backups all my devices. However, I am having a hard time with my Linux-powered laptop. I cannot back up my laptop\/computer when it is in suspended or sleep mode. How do\u2026","rel":"","context":"In &quot;Documentations&quot;","block_context":{"text":"Documentations","link":"https:\/\/monodes.com\/predaelli\/category\/documentations\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1789,"url":"https:\/\/monodes.com\/predaelli\/2016\/09\/28\/joining-debian-8-to-active-directory\/","url_meta":{"origin":2201,"position":2},"title":"Joining Debian 8 to Active Directory","author":"Paolo Redaelli","date":"2016-09-28","format":"link","excerpt":"Joining Debian 8 to Active Directory Joining a GNU\/Linux machine to a Microsoft Active Directory has been possible for years, but it\u2019s always been a bit of a science project that involved touching half-a-dozen obscure config files and usually resulted in me getting completely locked out of the machine. Various\u2026","rel":"","context":"In &quot;Documentations&quot;","block_context":{"text":"Documentations","link":"https:\/\/monodes.com\/predaelli\/category\/documentations\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":13841,"url":"https:\/\/monodes.com\/predaelli\/2025\/08\/12\/some-sources-can-be-modernized-run-apt-modernize-sources-to-do-so\/","url_meta":{"origin":2201,"position":3},"title":"Some sources can be modernized. Run \u2018apt modernize-sources\u2019 to do so","author":"Paolo Redaelli","date":"2025-08-12","format":false,"excerpt":"Thanks to Alan Pope that explained so clearly the Run \u2018apt modernize-sources\u2019 to do so issue at discourse.ubuntu.com: The notice \u201cSome sources can be modernized. Run \u2018apt modernize-sources\u2019 to do so\u201d appears because your Ubuntu system has detected software repository configurations using the older, traditional format (.list files, typically \/etc\/apt\/sources.list\u2026","rel":"","context":"In &quot;Debian&quot;","block_context":{"text":"Debian","link":"https:\/\/monodes.com\/predaelli\/category\/debian\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":14937,"url":"https:\/\/monodes.com\/predaelli\/2026\/02\/06\/sudos-maintainer-needs-resources-to-keep-utility-updated-the-register\/","url_meta":{"origin":2201,"position":4},"title":"Sudo&#8217;s maintainer needs resources to keep utility updated \u2022 The Register","author":"Paolo Redaelli","date":"2026-02-06","format":false,"excerpt":"Sudo's maintainer needs resources to keep utility updated \u2022 The Register \"For the past 30+ years I've been the maintainer of sudo,\" developer Todd C. Miller notes on his personal webpage. \"I'm currently in search of a sponsor to fund continued sudo maintenance and development. If you or your organization\u2026","rel":"","context":"In &quot;Ethics&quot;","block_context":{"text":"Ethics","link":"https:\/\/monodes.com\/predaelli\/category\/ethics\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":15957,"url":"https:\/\/monodes.com\/predaelli\/2026\/08\/25\/how-to-run-gui-applications-in-docker-x11-forwarding-and-vnc\/","url_meta":{"origin":2201,"position":5},"title":"How to Run GUI Applications in Docker (X11 Forwarding and VNC)","author":"Paolo Redaelli","date":"2026-08-25","format":"link","excerpt":"How to Run GUI Applications in Docker (X11 Forwarding and VNC) How to Run GUI Applications in Docker (X11 Forwarding and VNC) Learn how to run graphical applications inside Docker containers using X11 forwarding, VNC servers, and browser-based solutions for cross-platform GUI access. Running GUI applications in Docker enables isolated\u2026","rel":"","context":"In &quot;Senza categoria&quot;","block_context":{"text":"Senza categoria","link":"https:\/\/monodes.com\/predaelli\/category\/senza-categoria\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_likes_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/posts\/2201","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/comments?post=2201"}],"version-history":[{"count":0,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/posts\/2201\/revisions"}],"wp:attachment":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/media?parent=2201"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/categories?post=2201"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/tags?post=2201"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}