How would I disable accounts that have been inactive for 90 days in Linux?
<p>Working on a script that disables accounts that have been inactive for 90 days. Couldn't really find an answer after researching my problem for a few days, but I did find this command on a forum:</p>

<pre><code>    lastlog -t 10000 &gt; temp1; lastlog -t 90 &gt; temp2; diff temp1 temp2; rm temp1; rm temp2
</code></pre>

<p>This command outputs the users that have been inactive for 90 days. I think the solution to my problem would be to:</p>

<ol>
<li><p>Filter the output of this command so only the usernames are displayed (in a list, with 1 username per line).</p></li>
<li><p>Take this output and write it to a text file.</p></li>
<li><p>Run a for-loop that for each line in the file, the contents of the line (which should be just a single username) are stored in a variable called "inactiveUser". Then the command <em>usermod -L $inactiveUser</em> will be executed.</p></li>
</ol>

<p>Would my proposed solution work? If so, how could it be achieved? Is there a much easier method to lock inactive accounts that I am not aware of?</p>