Daniel Roberson
  • Posts
  • About
  • Notes
  • Projects
  • Time
  • Posts
    About
    Notes
    Projects
    Time

disabling bashrc

2024-08-27

It may be necessary to disable bashrc for a number of reasons:

  • a user added a mistake in .bashrc or .bash_profile that causes the shell to be unusable.

  • incident response and malware remediation.

Starting bash with –noprofile or –nosrc https://stackoverflow.com/questions/9357464/how-to-start-a-shell-without-any-user-configuration

Examples: bash –noprofile –norc

env -i bash –noprofile –norc env -i bash –rcfile /etc/profile ### if /etc/profile is clean.

Recompiling bash https://dmfrsecurity.com/2019/10/31/building-a-hardened-shell-for-attack-defend-ctf-supremacy/

  • edit config-top.h
    • set no_rc to 1
    • set no_profile to 1
  • recompile

No notes link to this note

Recent Posts

Linux Persistence: Modular Software

2025-04-17 DFIR CTF persistence linux persistence apache asterisk

Linux Persistence: Web Shells

2025-04-16 DFIR persistence webshell linux persistence webshell apache nginx PHP

Linux Persistence: Rootkits

2025-04-15 DFIR persistence rootkit LKM linux persistence LKM rootkit LD_PRELOAD kprobe ftrace ld.so hooking

Linux Persistence: Processes

2025-04-11 DFIR persistence processes linux persistence processes

Defanging Linux LKM Rootkits With cleanup_module()

2025-04-05 Linux LKM rootkits EDR hooks incident response Linux LKM rootkit


Home

About

Notes

Projects

Time

© All rights reserved. Powered by Hugo and Erblog.