In /etc/ntp.conf would I like to change all servers to just

server ntp.example.com

in just one command line.

I can do it with ssh like so

augtool --autosave --noautoload --transform "ssh incl /etc/ssh/ssh_config" set "/files/etc/ssh/ssh_config/ServerAliveInterval" 60

Can something similar be done for server in /etc/ntp.conf?


Considering there are likely more than one server entries in your file originally, you need two commands to achieve this:

rm /files/etc/ntp.conf/server
set /files/etc/ntp.conf/server ntp.example.com

and augtool can only take one command as a one-liner.

What you can do however is to use stdin for this, e.g.:

echo -e "rm /files/etc/ntp.conf/server\nset /files/etc/ntp.conf/server ntp.example.com" | augtool -sAt "Ntp incl /etc/ntp.conf"

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.