{"id":382,"date":"2024-03-10T21:32:07","date_gmt":"2024-03-10T21:32:07","guid":{"rendered":"https:\/\/anti-forensics.com\/blog\/?p=382"},"modified":"2024-03-12T01:44:40","modified_gmt":"2024-03-12T01:44:40","slug":"disable-bash-history-on-debian-12-for-a-single-user","status":"publish","type":"post","link":"https:\/\/anti-forensics.com\/blog\/disable-bash-history-on-debian-12-for-a-single-user\/","title":{"rendered":"Disable bash History on Debian 12 for a Single User"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">The Simplest single-user Method<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">While <code>.bash_history<\/code> is the default filename for storing command history in Bash, users can configure a different filename or location by setting the <code>HISTFILE<\/code> environment variable.<code>.bash_history<\/code> can contain sensitive information such as passwords, API keys, and other confidential data if users inadvertently execute commands containing such information.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>.bash_history<\/code> can be a valuable source of forensic evidence in investigations involving system compromise or unauthorized access. Forensic analysts can analyze <code>.bash_history<\/code> to reconstruct the sequence of events leading to a security incident.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Spawn another shell (<code>$ bash<\/code>)<\/li>\n\n\n\n<li>Use the command <code>$ unset HISTFILE<\/code><\/li>\n\n\n\n<li>Perform your operations<\/li>\n\n\n\n<li><code>$ exit<\/code><\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>user@debian:~$ bash\r\nuser@debian:~$ unset HISTFILE\r\nuser@debian:~$ ping google.com\nuser@debian:~$ exit<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">After choosing to exit the bash session, notice that the .bash_history file has not been updated.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The same operations can be performed for <code>zsh<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Another Technique<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>user@debian:~$ bash\r\nuser@debian:~$ export HISTFILE=\/dev\/null\r\nuser@debian:~$ ping google.com\r\nuser@debian:~$ exit\r<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The above ping operation is not saved to the .bash_history file upon exit of the bash shell as expected.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To make the changes permanent add <code>unset HISTFILE<\/code> or <code>export HISTFILE=\/dev\/null<\/code> to the end of the user .bashrc configuration file.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>While .bash_history is the default for storing command history in Bash, users can configure a different filename, location, or disable bash history by setting the HISTFILE environment variable.<\/p>\n","protected":false},"author":1,"featured_media":383,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[60,28,54],"class_list":["post-382","post","type-post","status-publish","format-standard","has-post-thumbnail","category-anti-forensics","tag-bash","tag-digital-forensics","tag-linux"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Disable bash History on Debian 12 for a Single User - Anti-Forensics.com<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/anti-forensics.com\/blog\/disable-bash-history-on-debian-12-for-a-single-user\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Disable bash History on Debian 12 for a Single User - Anti-Forensics.com\" \/>\n<meta property=\"og:description\" content=\"While .bash_history is the default for storing command history in Bash, users can configure a different filename, location, or disable bash history by setting the HISTFILE environment variable.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/anti-forensics.com\/blog\/disable-bash-history-on-debian-12-for-a-single-user\/\" \/>\n<meta property=\"og:site_name\" content=\"Anti-Forensics.com\" \/>\n<meta property=\"article:author\" content=\"https:\/\/facebook.com\/stercutis\" \/>\n<meta property=\"article:published_time\" content=\"2024-03-10T21:32:07+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-03-12T01:44:40+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/anti-forensics.com\/blog\/wp-content\/uploads\/2024\/03\/anti-forensics.com-disable-bash-history.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"1024\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Max\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Max\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/anti-forensics.com\\\/blog\\\/disable-bash-history-on-debian-12-for-a-single-user\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/anti-forensics.com\\\/blog\\\/disable-bash-history-on-debian-12-for-a-single-user\\\/\"},\"author\":{\"name\":\"Max\",\"@id\":\"https:\\\/\\\/anti-forensics.com\\\/blog\\\/#\\\/schema\\\/person\\\/ac3dd160cb42b1409a2a55dea58beec2\"},\"headline\":\"Disable bash History on Debian 12 for a Single User\",\"datePublished\":\"2024-03-10T21:32:07+00:00\",\"dateModified\":\"2024-03-12T01:44:40+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/anti-forensics.com\\\/blog\\\/disable-bash-history-on-debian-12-for-a-single-user\\\/\"},\"wordCount\":160,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/anti-forensics.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/anti-forensics.com\\\/blog\\\/disable-bash-history-on-debian-12-for-a-single-user\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/anti-forensics.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/03\\\/anti-forensics.com-disable-bash-history.jpg\",\"keywords\":[\"bash\",\"digital forensics\",\"linux\"],\"articleSection\":[\"Anti-Forensics\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/anti-forensics.com\\\/blog\\\/disable-bash-history-on-debian-12-for-a-single-user\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/anti-forensics.com\\\/blog\\\/disable-bash-history-on-debian-12-for-a-single-user\\\/\",\"url\":\"https:\\\/\\\/anti-forensics.com\\\/blog\\\/disable-bash-history-on-debian-12-for-a-single-user\\\/\",\"name\":\"Disable bash History on Debian 12 for a Single User - Anti-Forensics.com\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/anti-forensics.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/anti-forensics.com\\\/blog\\\/disable-bash-history-on-debian-12-for-a-single-user\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/anti-forensics.com\\\/blog\\\/disable-bash-history-on-debian-12-for-a-single-user\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/anti-forensics.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/03\\\/anti-forensics.com-disable-bash-history.jpg\",\"datePublished\":\"2024-03-10T21:32:07+00:00\",\"dateModified\":\"2024-03-12T01:44:40+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/anti-forensics.com\\\/blog\\\/disable-bash-history-on-debian-12-for-a-single-user\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/anti-forensics.com\\\/blog\\\/disable-bash-history-on-debian-12-for-a-single-user\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/anti-forensics.com\\\/blog\\\/disable-bash-history-on-debian-12-for-a-single-user\\\/#primaryimage\",\"url\":\"https:\\\/\\\/anti-forensics.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/03\\\/anti-forensics.com-disable-bash-history.jpg\",\"contentUrl\":\"https:\\\/\\\/anti-forensics.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/03\\\/anti-forensics.com-disable-bash-history.jpg\",\"width\":1024,\"height\":1024},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/anti-forensics.com\\\/blog\\\/disable-bash-history-on-debian-12-for-a-single-user\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/anti-forensics.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Disable bash History on Debian 12 for a Single User\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/anti-forensics.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/anti-forensics.com\\\/blog\\\/\",\"name\":\"Anti-Forensics.com\",\"description\":\"Rendering Digital Investigations Irrelevant\",\"publisher\":{\"@id\":\"https:\\\/\\\/anti-forensics.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/anti-forensics.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/anti-forensics.com\\\/blog\\\/#organization\",\"name\":\"Anti-Forensics.com\",\"url\":\"https:\\\/\\\/anti-forensics.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/anti-forensics.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/anti-forensics.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/01\\\/cropped-anti-forensics.com_.jpg\",\"contentUrl\":\"https:\\\/\\\/anti-forensics.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/01\\\/cropped-anti-forensics.com_.jpg\",\"width\":512,\"height\":512,\"caption\":\"Anti-Forensics.com\"},\"image\":{\"@id\":\"https:\\\/\\\/anti-forensics.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/groups\\\/14345620\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/anti-forensics.com\\\/blog\\\/#\\\/schema\\\/person\\\/ac3dd160cb42b1409a2a55dea58beec2\",\"name\":\"Max\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7ca31cae39a49ab947496651bc5c75ee545a72f31c02db1a5c31f80b28714601?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7ca31cae39a49ab947496651bc5c75ee545a72f31c02db1a5c31f80b28714601?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7ca31cae39a49ab947496651bc5c75ee545a72f31c02db1a5c31f80b28714601?s=96&d=mm&r=g\",\"caption\":\"Max\"},\"description\":\"Anti-forensics involves attempts to hide data, damage the confidentiality, integrity, and availability of data in an effort to make analysis and examination of this data (evidence) difficult or impossible.\",\"sameAs\":[\"https:\\\/\\\/anti-forensics.com\\\/blog\",\"https:\\\/\\\/facebook.com\\\/stercutis\",\"https:\\\/\\\/linkedin.com\\\/in\\\/jesse-shelley\"],\"url\":\"https:\\\/\\\/anti-forensics.com\\\/blog\\\/author\\\/realjesseshelley_hkwwlra2\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Disable bash History on Debian 12 for a Single User - Anti-Forensics.com","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/anti-forensics.com\/blog\/disable-bash-history-on-debian-12-for-a-single-user\/","og_locale":"en_US","og_type":"article","og_title":"Disable bash History on Debian 12 for a Single User - Anti-Forensics.com","og_description":"While .bash_history is the default for storing command history in Bash, users can configure a different filename, location, or disable bash history by setting the HISTFILE environment variable.","og_url":"https:\/\/anti-forensics.com\/blog\/disable-bash-history-on-debian-12-for-a-single-user\/","og_site_name":"Anti-Forensics.com","article_author":"https:\/\/facebook.com\/stercutis","article_published_time":"2024-03-10T21:32:07+00:00","article_modified_time":"2024-03-12T01:44:40+00:00","og_image":[{"width":1024,"height":1024,"url":"https:\/\/anti-forensics.com\/blog\/wp-content\/uploads\/2024\/03\/anti-forensics.com-disable-bash-history.jpg","type":"image\/jpeg"}],"author":"Max","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Max","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/anti-forensics.com\/blog\/disable-bash-history-on-debian-12-for-a-single-user\/#article","isPartOf":{"@id":"https:\/\/anti-forensics.com\/blog\/disable-bash-history-on-debian-12-for-a-single-user\/"},"author":{"name":"Max","@id":"https:\/\/anti-forensics.com\/blog\/#\/schema\/person\/ac3dd160cb42b1409a2a55dea58beec2"},"headline":"Disable bash History on Debian 12 for a Single User","datePublished":"2024-03-10T21:32:07+00:00","dateModified":"2024-03-12T01:44:40+00:00","mainEntityOfPage":{"@id":"https:\/\/anti-forensics.com\/blog\/disable-bash-history-on-debian-12-for-a-single-user\/"},"wordCount":160,"commentCount":0,"publisher":{"@id":"https:\/\/anti-forensics.com\/blog\/#organization"},"image":{"@id":"https:\/\/anti-forensics.com\/blog\/disable-bash-history-on-debian-12-for-a-single-user\/#primaryimage"},"thumbnailUrl":"https:\/\/anti-forensics.com\/blog\/wp-content\/uploads\/2024\/03\/anti-forensics.com-disable-bash-history.jpg","keywords":["bash","digital forensics","linux"],"articleSection":["Anti-Forensics"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/anti-forensics.com\/blog\/disable-bash-history-on-debian-12-for-a-single-user\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/anti-forensics.com\/blog\/disable-bash-history-on-debian-12-for-a-single-user\/","url":"https:\/\/anti-forensics.com\/blog\/disable-bash-history-on-debian-12-for-a-single-user\/","name":"Disable bash History on Debian 12 for a Single User - Anti-Forensics.com","isPartOf":{"@id":"https:\/\/anti-forensics.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/anti-forensics.com\/blog\/disable-bash-history-on-debian-12-for-a-single-user\/#primaryimage"},"image":{"@id":"https:\/\/anti-forensics.com\/blog\/disable-bash-history-on-debian-12-for-a-single-user\/#primaryimage"},"thumbnailUrl":"https:\/\/anti-forensics.com\/blog\/wp-content\/uploads\/2024\/03\/anti-forensics.com-disable-bash-history.jpg","datePublished":"2024-03-10T21:32:07+00:00","dateModified":"2024-03-12T01:44:40+00:00","breadcrumb":{"@id":"https:\/\/anti-forensics.com\/blog\/disable-bash-history-on-debian-12-for-a-single-user\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/anti-forensics.com\/blog\/disable-bash-history-on-debian-12-for-a-single-user\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/anti-forensics.com\/blog\/disable-bash-history-on-debian-12-for-a-single-user\/#primaryimage","url":"https:\/\/anti-forensics.com\/blog\/wp-content\/uploads\/2024\/03\/anti-forensics.com-disable-bash-history.jpg","contentUrl":"https:\/\/anti-forensics.com\/blog\/wp-content\/uploads\/2024\/03\/anti-forensics.com-disable-bash-history.jpg","width":1024,"height":1024},{"@type":"BreadcrumbList","@id":"https:\/\/anti-forensics.com\/blog\/disable-bash-history-on-debian-12-for-a-single-user\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/anti-forensics.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Disable bash History on Debian 12 for a Single User"}]},{"@type":"WebSite","@id":"https:\/\/anti-forensics.com\/blog\/#website","url":"https:\/\/anti-forensics.com\/blog\/","name":"Anti-Forensics.com","description":"Rendering Digital Investigations Irrelevant","publisher":{"@id":"https:\/\/anti-forensics.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/anti-forensics.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/anti-forensics.com\/blog\/#organization","name":"Anti-Forensics.com","url":"https:\/\/anti-forensics.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/anti-forensics.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/anti-forensics.com\/blog\/wp-content\/uploads\/2024\/01\/cropped-anti-forensics.com_.jpg","contentUrl":"https:\/\/anti-forensics.com\/blog\/wp-content\/uploads\/2024\/01\/cropped-anti-forensics.com_.jpg","width":512,"height":512,"caption":"Anti-Forensics.com"},"image":{"@id":"https:\/\/anti-forensics.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.linkedin.com\/groups\/14345620\/"]},{"@type":"Person","@id":"https:\/\/anti-forensics.com\/blog\/#\/schema\/person\/ac3dd160cb42b1409a2a55dea58beec2","name":"Max","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/7ca31cae39a49ab947496651bc5c75ee545a72f31c02db1a5c31f80b28714601?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/7ca31cae39a49ab947496651bc5c75ee545a72f31c02db1a5c31f80b28714601?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/7ca31cae39a49ab947496651bc5c75ee545a72f31c02db1a5c31f80b28714601?s=96&d=mm&r=g","caption":"Max"},"description":"Anti-forensics involves attempts to hide data, damage the confidentiality, integrity, and availability of data in an effort to make analysis and examination of this data (evidence) difficult or impossible.","sameAs":["https:\/\/anti-forensics.com\/blog","https:\/\/facebook.com\/stercutis","https:\/\/linkedin.com\/in\/jesse-shelley"],"url":"https:\/\/anti-forensics.com\/blog\/author\/realjesseshelley_hkwwlra2\/"}]}},"_links":{"self":[{"href":"https:\/\/anti-forensics.com\/blog\/wp-json\/wp\/v2\/posts\/382","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/anti-forensics.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/anti-forensics.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/anti-forensics.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/anti-forensics.com\/blog\/wp-json\/wp\/v2\/comments?post=382"}],"version-history":[{"count":4,"href":"https:\/\/anti-forensics.com\/blog\/wp-json\/wp\/v2\/posts\/382\/revisions"}],"predecessor-version":[{"id":387,"href":"https:\/\/anti-forensics.com\/blog\/wp-json\/wp\/v2\/posts\/382\/revisions\/387"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/anti-forensics.com\/blog\/wp-json\/wp\/v2\/media\/383"}],"wp:attachment":[{"href":"https:\/\/anti-forensics.com\/blog\/wp-json\/wp\/v2\/media?parent=382"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/anti-forensics.com\/blog\/wp-json\/wp\/v2\/categories?post=382"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/anti-forensics.com\/blog\/wp-json\/wp\/v2\/tags?post=382"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}