1

For example, I often need to login to a new virtual machine just to open "/etc/ssh/sshd_config" and set "PasswordAuthentication" option to "no".

In this way, I can not automate this process.

How to solve similar tasks by doing the modification from the command line?

1
# sed -i -r 's/^#?PasswordAuthentication .*/PasswordAuthentication no/' /etc/ssh/sshd_config
1

If you want to go whole hog into centralized configuration management, you can look at tools like Puppet and Chef. One can argue that this way lies both madness and salvation.

Depending on what you're trying to do and how many machines you're handling, investing in running a Puppet or Chef server may be like hammering a nail by dropping an aircraft carrier on it. On the other hand, an aircraft carrier may be what you actually need, depending on what you're trying to do.

0

sed, awk and perl are your friends. If not, you should have a look at them. As configuration files are different from software to software there cannot be a general solution. Create your own solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.