What release are you running on? In a quick test in 8.4, I see the expected behavior with a simple yang string leaf:
admin% set aaa authentication users user tom homedir "/home//dir"
...
[edit]
admin@Scotts-MacBook-Pro-2% show aaa authentication users user tom homedir
homedir /home//dir;
[ok][2025-12-16 16:33:17]
[edit]
admin% commit
Commit complete.
[ok][2025-12-16 16:33:41]
[edit]
admin% show aaa authentication users user tom homedir
homedir /home//dir;
[ok][2025-12-16 16:33:43]
[edit]
admin% set aaa authentication users user tom homedir /home///dir
[ok][2025-12-16 16:33:54]
[edit]
admin% show aaa authentication users user tom homedir
homedir /home///dir;
[ok][2025-12-16 16:33:57]
Oh, right. And with backslashes I see the same behavior as you and cannot get 2 \\ to be returned, even as I see escaping happening. e.g.
admin% set aaa authentication users user tom homedir home\dir
[ok][2025-12-17 15:35:11]
[edit]
admin% show aaa authentication users user tom homedir
homedir homedir;
[ok][2025-12-17 15:35:15]
[edit]
admin% set aaa authentication users user tom homedir home\\dir
[ok][2025-12-17 15:35:32]
[edit]
admin% show aaa authentication users user tom homedir
homedir "home\dir";
[ok][2025-12-17 15:35:34]
[edit]
admin% set aaa authentication users user tom homedir home\\\dir
[ok][2025-12-17 15:35:40]
[edit]
admin% show aaa authentication users user tom homedir
homedir "home\dir";
[ok][2025-12-17 15:35:43]
[edit]
admin% set aaa authentication users user tom homedir home\\\\dir
[ok][2025-12-17 15:35:49]
[edit]
admin% show aaa authentication users user tom homedir
homedir "home\\\dir";
[ok][2025-12-17 15:35:51]
And if you put a space in between, you can see the escaping happening properly:
admin% set aaa authentication users user tom homedir "home\\ \\dir"
[ok][2025-12-17 15:39:12]
[edit]
admin% show aaa authentication users user tom homedir
homedir "home\ \dir";
Thanks Scott for trying it out.
Any solution for this? As the use case we have is for encrypted passwords. The encryption may have double or more slashes, and if this escaped then the password will be corrupted and can not be used for authentication.
Without further investigation into the code as to why it doesn’t currently do it, it seems that the escaping such as “\\\\” that would result in “\\” doesn’t work. This is how it works in the shell:
micnovak-l-pw0c1e3h(config)# aaa authentication users user tom homedir “home\\\\dir”
micnovak-l-pw0c1e3h(config-user-tom)# top
micnovak-l-pw0c1e3h(config)# show configuration aaa authentication users | display xml
Looks like internally (in XML) there is double slash. Strings displayed in CLI show command are most probably escaped again, that’s why there are more backslashes.