Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
03-06-2005, 06:25 PM
|
#1
|
LQ Newbie
Registered: Aug 2003
Posts: 25
Rep:
|
Run PHP shell_exec as root
Hello
I am trying to get my php script to add a user using the shell_exec function and the shell function "useradd". I have tried this, which works from the shell
echo rootpass |sudo /usr/sbin/useradd -d /home/username -m -p userspassword username
This works from the shell, but doesn't work from the php script. I know basic shell_exec functions work, but this one needs to be executed as root, and I don't know what to do.
How can I fix this? Thanks
-Maneesh
|
|
|
03-06-2005, 09:17 PM
|
#2
|
LQ Newbie
Registered: Mar 2005
Location: Nampa, Idaho
Distribution: Fedora, Gentoox,...
Posts: 7
Rep:
|
try
Code:
echo rootpass |sudo "/usr/sbin/useradd -d /home/username -m -p userspassword username"
|
|
|
03-06-2005, 09:24 PM
|
#3
|
LQ Newbie
Registered: Aug 2003
Posts: 25
Original Poster
Rep:
|
nope, that doesn't work
|
|
|
03-06-2005, 09:37 PM
|
#4
|
LQ Newbie
Registered: Aug 2003
Posts: 25
Original Poster
Rep:
|
Hrm, now even my shell command won't work. Does anyone have any ideas as how to add a user to your computer from PHP?
-Maneesh
|
|
|
03-07-2005, 09:23 AM
|
#5
|
LQ Newbie
Registered: Aug 2003
Posts: 25
Original Poster
Rep:
|
bump. Ideas?
|
|
|
12-30-2008, 08:25 AM
|
#6
|
LQ Newbie
Registered: Dec 2008
Posts: 1
Rep:
|
Quote:
Originally Posted by maneeshsethi
bump. Ideas?
|
Yes. Webmin does that, but... Its CGI, not php.
btw, 5-YEAR-EPIC-BUMP
|
|
|
All times are GMT -5. The time now is 01:55 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|