qwerty

Unregistered less info
76 reputation
137
bio website
location
age
visits member for 1 year, 7 months
seen Sep 25 '12 at 15:43

Sep
9
comment Execute shell script from php, as root user?
"Did you check the log like i suggested?" If you read my previous commend you'll see that i quoted an important piece of the log file. The command "sudo ls" didn't work, for the same reason the adduser.sh script didn't work. At the absolute top of the PHP file i run this line: echo system('sudo ls'); die(); to which i get a completely blank respond. So, no respond in PHP. All i know is what's written in the log, and i don't know how to fix that. This is exactly what's written to auth.log on every page load: pastebin.com/raw.php?i=wfn4htxS
Sep
9
comment Execute shell script from php, as root user?
Also, if it matters, permissions for the make_account.sh file is -rwxrwxrwx which probably isn't very smart, but at least that confirms the problem isn't related to file permissions, right?
Sep
9
comment Execute shell script from php, as root user?
My bad, heh. I'm new to Linux, so i wasn't even aware that log existed, although i assumed there was a log somewhere. The log says auth could not identify password for [www-data] so i'm pretty sure it's sudo failing. I even tried doing system("sudo ls"); from PHP just to see if sudo worked. It didn't. Anyways, i added the code to /etc/sudoers as you advised but it still doesn't seem to be working. I have triple checked the path, so that's not the problem. If it helps, here is my sudoers file: pastebin.com/FNhdaJzL
Sep
8
comment Execute shell script from php, as root user?
Sorry, i didn't mean to sound ignorant, i know security is very important but it just wasn't what i was looking for. I do very much appreciate your help and will keep your suggestions in mind. I already have a bash script that creates a user, but the last code block sounds very interesting. I've tried to add www-data to the sudoers list, but it didn't seem to work (as written in the question), but i will try the code you suggested.
Sep
8
comment Execute shell script from php, as root user?
The problem is not about making the data secure by sanitizing/validating it before using it. I'm not concerned at all about the security since only i will be using it. Either way i still sanitize and validate the data before passing it on to the shell script, so that should work fine. The problem is that i don't know to execute a shell script with root access (without entering password) from a user that has no root access. You mentioned a "wrapper script", can you explain a bit more about that?
Sep
7
revised Automatically start named pipe reader on startup?
deleted 2 characters in body
Sep
7
asked Automatically start named pipe reader on startup?
Sep
7
comment Execute shell script from php, as root user?
I've been fibbling with named pipes for some time now and i really can't figure out how to actually use it for my purpose. I understand the principle of named pipes, but can't apply it to my needs. This is how i imagine it would work: Send data (in my case username and password) to named pipe from PHP, no root needed. I have another process running (with root access) which constantly reads from the pipe, and then executes the script with root access. Am i on the right track? If so, my question is, how do i create that other process that runs with root access and constantly reads from the pipe?
Sep
5
comment Execute shell script from php, as root user?
Thanks, i'll take a look at that!
Sep
5
comment Execute shell script from php, as root user?
I already knew it was a security breach, but since i'm just experimenting on a development server to learn i was going to let it pass. But fair enough, i'll do it the way it should be done. Your idea sounds fine except i need to create the user instantly, it has to be done as soon the PHP script goes off. Any ideas how to solve that? Thank you btw!
Sep
5
accepted Execute shell script from php, as root user?
Sep
4
asked Execute shell script from php, as root user?
Sep
4
accepted Can't SSH/FTP into new user account in Ubuntu?
Sep
4
asked Can't SSH/FTP into new user account in Ubuntu?
Sep
4
accepted Apache not responding on port 80 after forwarding port?
Sep
2
comment Home folder structure in Ubuntu 12.04.1?
Thanks, but i'm pretty sure i managed to screw it up completely now. Can't even access it through SSH anymore, i just get a timeout. Wasn't able to remove the old user account either. I'll mark your answer as accepted though, and just reinstall ubuntu tomorrow. I didn't have anything important on it, i'm just experimenting with it. Thanks though!
Sep
2
accepted Home folder structure in Ubuntu 12.04.1?
Sep
2
comment Home folder structure in Ubuntu 12.04.1?
I've moved all the files, do i have to change the ownership of the files to the new user or something or will it be good as it is?
Sep
2
comment Home folder structure in Ubuntu 12.04.1?
That does in fact sound like a more solid option. I'll give it a shot and report back, thank you!
Sep
2
awarded  Commentator