我想启用 linux 支持用户 8 小时,然后自动锁定他的登录。
前端是使用 PHP 构建的,下面是我使用过的..
// 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 有以下代码。
//Locking Support
shell_exec("passwd -l support");
这不起作用。请修复并帮助我找到解决方案。
最佳答案
修改 PHP.ini 文件以进行自定义时间配置。
对于 Ubuntu,应修改/etc/php5/apache2/php.ini 文件。
更改行:session.gc_maxlifetime=28800
(28800 秒 = 8 小时)
关于php - 如何使用 php 启用 Linux 支持用户一定数量的小时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16441695/