<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif;">
<div>
<div>Hello Serge and others on <span style="white-space: pre-wrap; widows: 1;">Pkg-shadow-devel</span>,</div>
<div><br>
</div>
<div>I believe the useradd utility is missing an fsync on the /etc directory itself to ensure durability after each rename.</div>
<div><br>
</div>
<div>Below is strace output on RHEL7 and Ubuntu 14.04.3.</div>
<div><br>
</div>
<div>Cheers,</div>
<div>Cat Zimmermann</div>
<div><br>
</div>
<div>$ strace -y useradd -M fakeuser 2>&1 | grep /etc | grep "rename\|fsync”</div>
<div><br>
</div>
<div>fsync(11</etc/passwd->)                 = 0</div>
<div>fsync(4</etc/passwd+>)                  = 0</div>
<div>rename("/etc/passwd+", "/etc/passwd")   = 0</div>
<div>fsync(4</etc/shadow->)                  = 0</div>
<div>fsync(4</etc/shadow+>)                  = 0</div>
<div>rename("/etc/shadow+", "/etc/shadow")   = 0</div>
<div>fsync(4</etc/group->)                   = 0</div>
<div>fsync(4</etc/group+>)                   = 0</div>
<div>rename("/etc/group+", "/etc/group")     = 0</div>
<div>fsync(4</etc/gshadow->)                 = 0</div>
<div>fsync(4</etc/gshadow+>)                 = 0</div>
<div>rename("/etc/gshadow+", "/etc/gshadow") = 0</div>
<div>fsync(4</etc/subuid->)                  = 0</div>
<div>fsync(4</etc/subuid+>)                  = 0</div>
<div>rename("/etc/subuid+", "/etc/subuid")   = 0</div>
<div>fsync(4</etc/subgid->)                  = 0</div>
<div>fsync(4</etc/subgid+>)                  = 0</div>
<div>rename("/etc/subgid+", "/etc/subgid")   = 0</div>
</div>
<div><br>
</div>
<div>$ done.</div>
<div><br>
</div>
<div>
<div id="MAC_OUTLOOK_SIGNATURE"></div>
</div>
</body>
</html>