chattr +i /etc/ssh/sshd_config

Category: Security & Hardening

chattr +i /etc/ssh/sshd_config

Make a config file immutable

Sets the immutable attribute so even root cannot modify, delete, or rename the file until it is removed with chattr -i. This blocks tampering with SSH settings by malware or attackers. Remember to clear the attribute before editing, and run sshd -t afterwards.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.