Hide Forgot
Description of problem: When saving a file (in this case /etc/ssh/sshd_config), augeas is able to create the sshd_file file, but not the ssh directory. Version-Release number of selected component (if applicable): augeas-1.1.0-3.el7 How reproducible: Always Steps to Reproduce: $ mkdir -p /tmp/root/etc $ augtool -r /tmp/root/ augtool> set /files/etc/ssh/sshd_config/X11Forwarding yes augtool> save Saving failed augtool> print /augeas/files/etc/ssh/sshd_config/ /augeas/files/etc/ssh/sshd_config /augeas/files/etc/ssh/sshd_config/error = "open_augnew" /augeas/files/etc/ssh/sshd_config/error/message = "No such file or directory" augtool> quit $ mkdir -p /tmp/root/etc/ssh $ augtool -r /tmp/root/ augtool> set /files/etc/ssh/sshd_config/X11Forwarding yes augtool> save Saved 1 file(s) augtool> quit Actual results: The intermediate directories are not created and the configuration files is not saved. Expected results: The intermediate directories are created and the configuration files is saved. Additional info: http://www.redhat.com/archives/augeas-devel/2008-November/msg00012.html
Can reproduce with augeas-1.1.0-6.el7 Steps to reproduce: [host-b]#mkdir -p /tmp/root/etc [host-b]# augtool -r /tmp/root/ augtool> set /files/etc/ssh/sshd_config/X11Forwarding yes augtool> save error: Failed to execute command saving failed (run 'print /augeas//error' for details) augtool> print /augeas/files/etc/ssh/sshd_config/ /augeas/files/etc/ssh/sshd_config /augeas/files/etc/ssh/sshd_config/path = "/files/etc/ssh/sshd_config" /augeas/files/etc/ssh/sshd_config/mtime = "0" /augeas/files/etc/ssh/sshd_config/lens = "@Sshd" /augeas/files/etc/ssh/sshd_config/lens/info = "/usr/share/augeas/lenses/dist/sshd.aug:123.12-125.36:" /augeas/files/etc/ssh/sshd_config/error = "mk_augtemp" /augeas/files/etc/ssh/sshd_config/error/message = "No such file or directory" augtool> quit [host-b]#mkdir -p /tmp/root/etc/ssh [host-b]#augtool -r /tmp/root/ augtool> set /files/etc/ssh/sshd_config/X11Forwarding yes augtool> save Saved 1 file(s) augtool> quit [host-b]#cat /tmp/root/etc/ssh/sshd_config X11Forwarding yes
After discussing with SRT, I'm unsure now that there's any precedence for doing this, so am inclined to reject the request. Usually text editors (thinking vim etc), shells (I/O redirection) or utilities (touch) won't create parent directories if you request that they create a file in a directory that doesn't yet exist. Just on this point, I don't think that Augeas should be any different. The only case that SRT could think of was perhaps Webmin, but I wouldn't compare Augeas to Webmin. Unlike SELinux contexts, we don't have a database of any sort to know what the correct permissions and ownership should be. The umask would be a fairly safe bet, but I'd say this behaviour would still be unusual and possibly unexpected. The thread linked in the description does detail many of the risks. The only outcome that David suggests to be reasonable is adding metadata to the tree for ownership, mode etc, but this feels a bit complex to me, and probably wouldn't be used in practice (at least not in your simple example).
This request was not resolved in time for the current release. Red Hat invites you to ask your support representative to propose this request, if still desired, for consideration in the next release of Red Hat Enterprise Linux.