I want to enable linux support user for 8 hours and then lock his login automatically.
Front end is built using PHP and below is what I have used ..
// Enabling Support
shell_exec("sudo passwd -u support");
// Time to Expire
$date = date("h:i:s A", strtotime('+8 hours'));
$timeat = substr($date,0,2).substr($date,9,11);
// Cron setup using 'at' command
shell_exec("sudo at ".$timeat." -f /path/to/cron/disablesupport.php");
disablesupport.php has the below code.
//Locking Support
shell_exec("passwd -l support");
This didn't work. Please fix and help me with a solution.