In your php code:
system( "sudo /usr/local/bin/lock_user $the_user" );
You'll need to create a script called /usr/local/bin/lock_user that
contains:
#!/bin/bash
passwd --lock $1
Make it executable and then, you'll need to add an entry to the sudoers
file to allow www-data to run the /usr/local/bin/lock_user command.
I'm not an expert at sudo, so others may have a better entry for the
sudoers file. But, if you add a line like this to the /etc/sudoers file, I
think it'll work:
www-data ALL = NOPASSWD: /usr/local/bin/lock_user
I'm sure there's some security issues with what I've just shown. for
instance, you should probably verify that the value in $the_user contains
only a userid and nothing else.
Once you get that working, then write another command to unlock the user.
The point is, running a command is WAY easier and safer than trying to
edit the passwd file.
Jim McQuillan
j...@ltsp.org
On Fri, Nov 9, 2012 at 8:35 PM, Robert Lefebvre <robert.r.lefeb...@gmail.com
> wrote:
> Hey, thanks for all the great replies.
>
> The reason for using PHP is that I use the list of registered users in
> Ubuntu as the "master" data list for a number of present and future custom
> website functionality. For example, the PHP pulls the list and creates a
> form to manage their electives. Their actual choices vary each day so I use
> PHP and Mysql to maintain a db with their classes. I also use PHP to
> provide multilevel access (i.e. different for students, parents, teachers
> and admin) to the web pages for such things as forms, news, resources etc.
> The passwd file works great as a "read source" since only registered
> students will be given access to the web pages. There are some other
> benefits as well to using php and a database.
>
> All the command line code is great, but unless someone can tell me how to
> let these php pages write to the command line then I would have to not only
> give the teachers access to it but would actually have to teach the
> teachers to code and, well, they already think I'm way over the edge as far
> as "geekiness" and they would be certainly less than enthusiastic students
> for sure.
>
> I'll definitely study up on the programs and methods suggested. Off the
> cuff (before studying those recommendations) it sounds like adding PHP to
> sudoers would work but can I scale back the permissions from total sudo to
> a less functional sudo?
>
> Thanks
>
> --
> BungeeBones.com - A B2B Link Exchange - Free Links in limited locations -
> human edited and reviewed - Networked online advertising business
> opportunities available through our free, distributed web directory script
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_nov
> _____________________________________________________________________
> Ltsp-discuss mailing list. To un-subscribe, or change prefs, goto:
> https://lists.sourceforge.net/lists/listinfo/ltsp-discuss
> For additional LTSP help, try #ltsp channel on irc.freenode.net
>
>
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_nov
_____________________________________________________________________
Ltsp-discuss mailing list. To un-subscribe, or change prefs, goto:
https://lists.sourceforge.net/lists/listinfo/ltsp-discuss
For additional LTSP help, try #ltsp channel on irc.freenode.net