Hi Pat, On 11/11/11 18:24, Pat Riehecky wrote: > Lets say my ideal /etc/ssh/ssh_config looks like this > > > Host A > GSSAPIAuthentication yes > Host B > GSSAPIAuthentication yes > ForwardX11 yes > Host * > ForwardX11Trusted yes > > > > And my current one looks like: > > > Host A > GSSAPIAuthentication yes > Host * > ForwardX11Trusted yes > > > > I haven't been able to find a good way to locate 'Host *' and put 'Host > B' above it. > $ augtool ls /files/etc/ssh/ssh_config/ > Host[1]/ = A > Host[2]/ = * > > I've tried: > > ls /files/etc/ssh/ssh_config[ Host = '*' ] > ls /files/etc/ssh/*[ Host = '*' ]
Nearly: augtool> match /files/etc/ssh/ssh_config/Host[ . = '*' ] /files/etc/ssh/ssh_config/Host[2] = * The expression Host[ . = '*' ] is looking for Host nodes and the "." refers to the value of the node (or self::*). The reason the first command didn't work as expected is because it looks for an ssh_config node where a subnode Host is "*". You actually want to match the Host node itself, so that has to be in the path on the left. This wiki page has some examples that can be useful: http://augeas.net/page/Path_expressions > But, while strange, my main problem is I have no idea how to even add a > new host definition. > > augtool ins B before /files/etc/ssh/ssh_config/Host[2] > > Just doesn't work. You're close... instead, you need "ins Host .." as you add the node with the label "Host" and then once it's there you can set the value of the node to "B". Check "help ins" in augtool and it'll refer to the label as opposed to the value. So in full: augtool> ls /files/etc/ssh/ssh_config/ Host[1]/ = A Host[2]/ = * augtool> ins Host before /files/etc/ssh/ssh_config/Host[ . = '*' ] augtool> set /files/etc/ssh/ssh_config/Host[ . = '' ] B augtool> ls /files/etc/ssh/ssh_config/ Host[1]/ = A Host[2] = B Host[3]/ = * augtool> set /files/etc/ssh/ssh_config/Host[ . = 'B' ]/GSSAPIAuthentication yes augtool> set /files/etc/ssh/ssh_config/Host[ . = 'B' ]/ForwardX11 yes augtool> print /files/etc/ssh/ssh_config/ /files/etc/ssh/ssh_config /files/etc/ssh/ssh_config/Host[1] = "A" /files/etc/ssh/ssh_config/Host[1]/GSSAPIAuthentication = "yes" /files/etc/ssh/ssh_config/Host[2] = "B" /files/etc/ssh/ssh_config/Host[2]/GSSAPIAuthentication = "yes" /files/etc/ssh/ssh_config/Host[2]/ForwardX11 = "yes" /files/etc/ssh/ssh_config/Host[3] = "*" /files/etc/ssh/ssh_config/Host[3]/ForwardX11Trusted = "yes" augtool> save Saved 1 file(s) Hope that helps. Cheers, -- Dominic Cleal Red Hat Consulting m: +44 (0)7817 878113 _______________________________________________ augeas-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/augeas-devel
