Ubuntu Security :: Running Shell Commands From Apache
Jun 3, 2011
Ok, so I have a few web apps that need to run shell commands. Heres a great example of one:
Code:
This is a PHP script getting my system volume. Herein lies the problem... www-data doesn't have permission to do this!
I changed my apache config to use MY account as the web user, and it does in fact work the way I want it to.
Obviously, I dont want to leave apache running as me, and want it to keep using www-data.... heres my question... how can I give permission for www-data to execute certain programs?
View 3 Replies
ADVERTISEMENT
Apr 5, 2011
I'm trying to modify an existing user so that any files they create can be at least read (although writing and execution would be nice) by any other user. The reason is because I need the daemon running my Apache server to be able to access files created by a daemon running under this user, files which will be created and accessed in real-time.
View 3 Replies
View Related
Jun 30, 2010
I'm about to have a web server at home for the first time. I've always missed having full control and not having to contact my hosting company when I need to do some specific changes - and some changes they won't do for you at all.I've chosen the non-GUI Ubuntu Server with LAMP, and nothing more is installed really except for a couple of command line tools from the repository. The LAMP software has been locked down as good as I can by following some guides on the net and using common sense. Like Apache 2 don't have access to the file system except for the www folder, and setting the headers to Prod. MySQL has skip-networking and I've commented out the listen string to localhost. PHP has a truckload of functions that I've disabled in the php.ini, also by following some guides on the net, among some other security enhancing php.ini editing.
The only thing the server will serve is a well known PHP forum and some html docs, and that's all. Nothing advanced or complicated stuff, and I'm definitely not programming PHP myself or letting anyone do it for me.But I do want to sleep well at night knowing that my server is always on and sitting on the edge of my home network! And can I do that? I've heard that you don't need to be worried about getting your Linux server box hacked, but you should be worried about anyone getting root access to it. But is it really that simple? Ubuntu is shipped without root account and you must have the sudo password, right? What's the odds for anyone to get full access to my system?An issue: I've heard that Apache never must run as root. When I do a ps -ef, I see that there are several www-data processes running apache, but there's one root process running apache too. Is this normal and is it safe?An issue: I've heard that PHP can fail pretty easily. But isn't PHP running under apache 2 and limited by the www-data filesystem access?An issue: MySQL is running as a MySQL user, and I guess that's an unprivileged user right?
View 9 Replies
View Related
Sep 25, 2010
I have a VPS that has 512MB of ram. I'm using it as a mail/web server. It keeps running out of memory. I know amavis/clamav are memory hogs, but I checked my ps aux and found 100's of instances of "apache-init-server" running. I killed them all, and they keep spawning back. What could be causing this. I've never seen this on a webserver before. OS: CentOS 5.5
View 10 Replies
View Related
May 22, 2011
The panel plugin from xfce4-mixer has a bug:s icon doesn't update as the volume is changed. This bug has already been reported.One curious thing about it is that, if you right click on the volume icon on the panel, go to 'Settings' (or 'Properties', I don't know, mine is in Portuguese) and then close the window that pops on the screen, the icon is updated.Is it possible to open and close the settings window automatically with a bash script? Like this, I could associate this script with the volume keys of my keyboard, so that the icon is updated as the the volume is changed.
View 2 Replies
View Related
Nov 26, 2009
what is the command for:
locking the screen
creating a new folder
log out
on the shell?
View 3 Replies
View Related
Sep 14, 2011
Programs like matlab/octave and I'm sure many other ones allow you to start typing a command, and then hit Up to recall the last command that starts with the typed characters. Common linux shell bash doesnot do this. Is there a different shell that does? I'm not asking how to find out the last command, I'm asking if there's a shell that's a little friendlier.
View 3 Replies
View Related
Aug 24, 2010
i need to run a command from a shell script that requires me to answer "Yes" to 2 questions that the command asks before it kicks off. how do i do this? i thought it was something like this.. from inside the parent script:
sh test.sh << "EOF
Yes
Yes
[code]...
View 3 Replies
View Related
May 24, 2010
How can I run the following be run from a shell script, these are shell commands and mysql commands.
# mysql -uroot -ppassw
> use mysql;
> create database cacti;
> GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'cactipw';
# mysql -u root -p -b cacti < /usr/share/cacti/cacti.sql
View 2 Replies
View Related
Apr 3, 2011
In below program I want to add (as part of the valid_cmds string) the pwd (print working directory), lo (logout), and cd (change directory) commands. However when I add those into original program ;
char *valid_cmds = " ls ps df pwd lo cd";
they are not working I have the cout message huh?
Original source code is below code...
View 3 Replies
View Related
Jun 23, 2011
I want to copy a file (home/remote_computer_user/Desktop/test1.txt) from my remote office computer (a permanent URL + open port) to my home computer (home/home_computer_user/Downloads/).
How can I do this with shell commands in Linux?
My current thoughts:
ssh <user>@<computer1address> -p <port> - gives me a shell on the remote computer
(I think I should use scp, but I dont how exactly how in my case)
What are the exact commands I should use?
View 1 Replies
View Related
Jan 5, 2011
I have a command which on the command line needs to look like this
rlam -if3 '!pvalue -H image1.jpg' > image2.jpg
Nevermind what rlam or pvalue do ... they are part of a program package I am using. The above command works on the command line, and also when written verbatim in a bash shell script.
My problem is: in the script I wish to replace image1.jpg with the content of a variable, e.g.
IM1=image1.jpg
How to I get the script to insert the value of $IM into the command when the pvalue part of it needs to be quoted?
View 1 Replies
View Related
Aug 5, 2010
Ares there any shell commands to display all applications installed in my linux machine,?
View 7 Replies
View Related
Jul 14, 2010
Note: I have made a thread similar to this before, but the title/contents were too botched to repair.I know that using C-r you can search for past bash commands containing a particular string, but how would you search for past bash commands matching a particular regular expressionIs there a keyboard shortcut for that or do you have to use a shell command?
View 4 Replies
View Related
Feb 3, 2010
Is there a way to delete files on the commandline that uses the KDE-Wastebin?It appears that I never ever need the KDE4 Wastebin for files that I deleted through Konqueror or Dolphin. It is only when I delete files on the konsole with rm that I wish I could undelete them. It always happens like that, mostly by being in the wrong directory or using a wildcard when I should not have. (I don't have any erroneous deleted file right now, and I do have plenty of backups, but I just wonder whether there is something better than rm to use generally on the commandline.)
View 9 Replies
View Related
Jan 5, 2011
I am trying to write a script that connects to a server and executes some commands on there. Something like this:
#!/bin/sh
telnet remote_machine
cd /home/some_directory
cat a_file_in_current_directory
Unfortunately after login/password I guess the script doesn't jump past the telnet command, until I exit. What do I need to do to make the script start executing commands in the remote shell?
View 1 Replies
View Related
Nov 7, 2010
i was trying to figure out a way to write my own linux commands.. in fact i wanted to write a shell script to simulate an already existed linux commands like 'cd','ls' and'adduser'i just dont know the language of scriptting and even doesnt know the steps to make a script
View 3 Replies
View Related
Jun 19, 2010
i want to know how can i change the owner of the mysql data base with shell commands.
View 3 Replies
View Related
Jun 26, 2010
php. I am developing a web-interface for an application that sometimes needs root privs. Editting /etc/sudoers is not an option since the web interface needs to be portable to other users when they install my application. Is there any workaround ?PHP Code:
php code:$command = "./script.sh /dev/$DISKNAME &";$shellOutput = shell_exec($command);
Code:
[code]...
View 2 Replies
View Related
May 11, 2010
I have a few questions regarding HTML, UNIX and Javascript. I've been tasked with creating a fairly simple webpage that takes a few inputs. Each input must correspond to an argument in a UNIX command running on a server.On a UNIX server we have a script (.ksh) that takes 3 arguments. The result of the script is a data file which is FTP'ed to an external server. Let's forget about the FTP portion for now. I would like to know where I should begin.What I know so far:
1) I will need HTML to create the webpage. Skill level is high
2) I will need Javascript to make my webpage more interactive. Skill level is high.
3) I will need to understand the UNIX environment. Skill level is high.
View 8 Replies
View Related
Apr 24, 2011
I upgraded from Slackware 64 13.1 to Slackware 64 13.37 a week or so ago. I am now having a perceptible delay of a few seconds when launching commands from the command line, say for example: screen -R.
My laptop is an X200 with 3GB of RAM.
View 7 Replies
View Related
Apr 11, 2010
I am trying to boot debian on my nexus one the guide i am using is telling me to run these commands
I am getting to the point where i type the command # cd /sdcard/debian but it tells me cd: can't cd to /sdcard/debian.
View 9 Replies
View Related
Sep 22, 2010
I have been trying to figure out how to automatically run terminal commands on login. For example, I want to run Firefox on login. When I run 'firefox' in terminal, it opens. This is what I tried:I went to System > Preference > Startup Applications and clicked on 'Add'. I gave it a name, typed 'firefox' into the command field and left the comment blank and added it to the list, making sure that the box was checked.
View 1 Replies
View Related
Dec 15, 2010
Is there an easy way to prevent the logging of commands run into syslog as post-shell expansion?
I.e log a command of "ls *.log" as just that, rather than "ls a.log b.log c.log d.log" It makes rather a mess of the log files.
View 1 Replies
View Related
Jul 20, 2011
I am new to Minix. I'm so impressed by the speed of the system. It looks elegant, I like it. However, I have a question about the shell. In Linux, while using a shell, up and down arrow keys can be used to navigate through previously executed commands. On Minix with the sh shell, I can only get numbers printed out on the screen. I remember I chose a US-std keyboard when installing. Is there any way to use the arrow keys to navigate through previous commands on Minix?
View 1 Replies
View Related
Jul 26, 2010
I recently hired a new tech guy to start managing our servers. In doing this I went ahead and upgraded all the servers. It has been awhile now since I sent him the details of the new server and the last time I talked to him he was joking around with one of the other clients not realizing how long it took.
I know on other server moves, my old guy could have everything setup and running in a couple days as a good amount of time is waiting for the data to copy over. I am starting to wonder if this guy is going to try and throw a huge bill at me, so I would like to know what hes doing on the server with time stamps just so I can get a idea of how much time he has been logged into the server. Does this server OS have anything like this built in?
View 1 Replies
View Related
Apr 16, 2010
Is there anyway to test a bash script without actually running the commands to see if the syntax is proper? Google is of no help.
View 5 Replies
View Related
Nov 19, 2010
I recently decided to attempt to implement automatically disabling my laptop's touchpad when my external mouse is connected, and I am just about there.Unfortunately, what I suspect to be a permissions problem is stopping me from succeeding.Here's what I have done sofar:Written a Script which will enable or disable the touchpad based upon cli argument (verified to work when called via terminal)Set up a rule for halevt which successfully launches an arbitrary command when the mouse is connected or disconnected (even successfully logging itself)Determined that the script is in fact being called upon device connection (by adding echo statements to the script which are working)When launching halevt, I have even tried running it as my user/group, and with a special config file, all to no avail.Also, here is my command to run halevt:
Code:
sudo halevt -u brendon -g brendon -c /home/brendon/.halevt.xml
My .halevt.xml file:
[code]....
View 4 Replies
View Related
Mar 17, 2011
I am running a shell script from a rc file in Linux. The shell script is going into a loop which runs for 8 hours. Now I want to prevent the shell script from running when Linux boots or I need to find a way to kill the shell script when it is running. I tried using killall, kill $! and Ctrl+C etc. Nothing seems to work. Can you suggest a way out. I am new to Linux.
View 2 Replies
View Related
Apr 14, 2011
I am trying to run some simulations through SSH from my mac on our university SOLARIS system. My problem is that whenever I want to execute a command I get an error which says "Invalid argument". Maybe I should explain more what I want to do and what I did.Firstly I installed a software which I need to run, I did it through ThinLink, and it seems that it is running fine without a problems. I can execute all commands and scripts. Installed software contains tens of small programs. I have compiled it and assign the PATH to be able to use the software. This was still via ThinLink. Then I wanted to start to use SSH since it should be more secure and also faster for me. When I wanted to do same think as in ThinLink I got the message Invalid argument. For example I run a command which use program gensky. I wrote:
Code: gray1(dava) $ gensky 4 4 4
I got:
Code: -bash: ............/Radiance_install/bin/gensky: Invalid argument (i replaced the path to my home directory by dots) The PATH to the program seams correct but it does not run correctly. With SSH I can log into the remote machine and see all the files which I have on the disk as well as to run standard commands like mkdir etc. But I cannot run the programs which I installed.
View 3 Replies
View Related