Load hierarchical config

You can, if you want, load hierarchical config directly under the edit prompt if you have such a piece of config. For example you just want to copy a section of config you already have working from one device to another or maybe you want to copy a piece of config you have seen.

Here we copy a user definition into another device using the load merge command.
Also note the use of the "relative" keyword as we are not loading at the top of the hierarchy


root@RIGHTY# edit system login             

[edit system login]
root@RIGHTY# load merge relative terminal
[Type ^D at a new line to end input]
user blogger {
            uid 2000;
            class super-user;
            authentication {
                encrypted-password "$1$t4LMXMGM$unCU/I8CfgIYvnF4vDa6p1"; ## SECRET-DATA
            }
        }
load complete


[edit system login]
root@RIGHTY# show | compare
[edit system login]
+  user blogger {
+      uid 2000;
+      class super-user;
+      authentication {
+          encrypted-password "$1$t4LMXMGM$unCq/I8CfgIYvnFqvDa6p1"; ## SECRET-DATA
+      }
+  }

[edit system login]
root@RIGHTY# commit check
configuration check succeeds


[edit system login]
root@RIGHTY# commit
commit complete


[edit system login]
root@RIGHTY#


So you can do it that way if you want to or have to. Of course if you manage the device the slice of hierarchical config comes from you can always convert it back to its set based command for easier input into another device..

root@RIGHTY> show configuration system login | display set
set system login user blogger uid 2000
set system login user blogger class super-user
set system login user blogger authentication encrypted-password "$1$t4LMXMGM$unCq/I8CfgIYvnFqvDa6p1"

root@RIGHTY>

Easy eh!

Model: srx100h
JUNOS Software Release [10.4R7.5]

No comments:

Post a Comment