Let's say I want to edit the /etc/ssh/sshd_config file in RHEL 7 to secure our ssh configuration.
I want to replace let's take the Ciphers line for example, keeping the original in place and commenting it out. I also want to be able to key off of the smallest part of the string as possible to keep from having Red Hat break it every time they update the rpm / install iso.
Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,3des-cbc,aes192-cbc,aes256-cbc
should become...
#Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,3des-cbc,aes192-cbc,aes256-cbc
Ciphers abc-123,def-456,ghi-789 etc...
I have tried to do a find / add newline in a test file where the filename is testfile, and the contents are This is my test file. I tried adding No it's not as a new line and have miserably failed.
sed -i '/This is my test file./aNo it's not.' testfile
How would I go about that and more importantly, what are the key concepts behind it?