Programming :: Run Cgi As Root Using Setreuid Failing
Nov 16, 2010
I'm calling a cgi-script on an apache webserver. The script needs to create a textfile and write certain values into it. When I do:
Code:
static const std::string outputFile( "/flash/myfile.ini" );
std::fstream fileStr( outputFile.c_str(), ( std::fstream::out | std::fstream::trunc ) );
if( !fileStr.is_open() )
{
throw std::runtime_error( "Failed to open config file." );
}
The runtime error is always thrown.
So I wish to run this cgi as root by doing this:
[Code]....
View 1 Replies
ADVERTISEMENT
Jan 25, 2010
I have a strange problem with a simple program. I have a container class that holds a pointer. I did this so I could use another container class that does several pass by value calls. I didn't want to be copying the object over and over again, so decided to build this simple container that simply copied the pointer in the copy constructor.
However, the pass by value call seems to be failing in a strange way. When the pass-by-value function is called, the program jumps into the copy constructor just fine and performs the pointer assignment operation. The program will copy the pointer value 0x20 (for argument sake) to the "this->base" location. Within the copy constructor, this has the address 0x28. Then when it jumps into the function, instead of pass by value argument being at 0x28 (as expected), it is at 0x36. Then 0x36->base has the address 0x28. Thus the base is now pointing at what was the new pointer container. At this point the data is corrupted and random things happen.
It seems that there is some strange assignment and double nesting going on. I really do not understand what is going on.
Below is some code. I have stripped away all the other code trying to isolate the problem. I have added comments explaining what my debugger is telling me.
Code:
using namespace std;
class paramPnt // Need to determine how order is tracked
{
private:
long order;
[Code].....
View 4 Replies
View Related
Mar 8, 2010
Using ant with
Code: Select all<script language="jython" manager="auto">
is failing
BUILD FAILED
/root/dawndusk/times_build.xml:25: Unable to create javax script engine for jython
at org.apache.tools.ant.util.optional.JavaxScriptRunner.evaluateScript(JavaxScriptRunner.java:86)
at org.apache.tools.ant.util.optional.JavaxScriptRunner.executeScript(JavaxScriptRunner.java:69)
I have ant-optional installed. Do I need to register specific languages?
Apache Ant version 1.8.0 compiled on February 20 2010
Detected Java version: 1.6 in: /usr/lib/jvm/java-6-openjdk/jre
View 1 Replies
View Related
Aug 4, 2010
I am using Ubuntu 9.04Following is a startup script I am trying.
Code:
#!/bin/sh
USER=lighttpd
[code]....
View 3 Replies
View Related
Nov 18, 2010
I have this command in ksh:
1. typeset -i INTEGER INTEGER=aaa In all platforms except of Linux it is failing and return exit code 1 Why in Linux it is not failing? I must it for my number tests
2. The same for printf command. Only in Linux the bellow command is not failing: printf "%d" aaa
View 7 Replies
View Related
Mar 28, 2011
I've got a problem with a piece of code. Basically, I use my listRegularFiles function in two separate places in my code. The first time I run itit appears to work perfectly well. If I use it a second time, however, it blows a gasket. I'll post my code below, and if anybody has any ideas,Here's the code for listRegularFiles:
Code:
string listRegularFiles(char* dirname)
{
[code]...
View 2 Replies
View Related
Mar 12, 2010
Does anyone see a problem with my code? attempting to do a strdup is failing with a segmentation fault within libcplugintools.h
Code:
/* Provide function for adding files to be copied/linked
into report
[code]...
View 1 Replies
View Related
Sep 9, 2010
I need a way to find all the files not owned by root:root on the commandline. How can this be done?
View 2 Replies
View Related
Jun 28, 2010
I'm running the following code to initiate semaphores:
Code:
int init_semaphore(key_t semkey, int nsems)
{
[code]...
View 3 Replies
View Related
Jun 16, 2010
debug my code as root in eclipse without starting the eclipse as root? I searched on the net, and seems like it is not possible.
View 4 Replies
View Related
Mar 15, 2010
Anyone has the idea of su-root and the password hard coded in a shell scripting?I had tried couple of test, but still fails.
View 1 Replies
View Related
Mar 1, 2011
I am trying to administer a small group of ubuntu desktops in my classroom. I can use ssh to perform administrative tasks one at a time on each machine, but I want to automate these tasks through a small number of scripts. I am having trouble with running root commands through a script.
On other distros, I think I would simply ssh into the root account, and run the script. But as an ubuntu user, I have only ever used sudo, and folks at ubuntuforums are understandably hesitant to recommend logging in as root. Instead I am seeing suggestions to disable the password requirement for each specific command I want to run, which does not seem like best practice.
Should I enable the root account, give it a password, and ssh to the root account to run the scripts? To be specific, the scripts will do things like install updates, install programs, add or delete users, configure the desktop, etc.
View 5 Replies
View Related
May 16, 2010
I'm trying to build a custom setup that requires a flash drive and a CD to both be mounted to root. Applications, boot data, and other static directories are on the CD, while /home, /opt, and /tmp are on the flash drive. Is there a special option I can enter into fstab to allow this? If not, I intend to modify my kernel to allow this, but I'll need to find the sources that control this function.
View 4 Replies
View Related
Aug 31, 2010
I am trying to write a script that will create a directory, copy files to it, zip them, move the zip file to the desktop and clean up.However, when I run the script, it comes back stating that I do not have permission to make the directory. I wanted to know how to add the permission into the script to allow for access to whoever runs the script to pull the logs, but won't leave the system in the root user?here is what I have for code so far:
#!/bin/bash
host= 'hostname'
mkdir /home/savelogs
[code]....
View 1 Replies
View Related
May 31, 2011
I have a script which when invoked will generally su into being a number of different users (for those that have read other threads from me, you will know.I am building my own user based package management system).Whilst 75 - 80% of the time there will be no need to be anyone other than the original user, there are times when the root password is required. Currently this is presented to the administrator at exactly the point in the script that it is required.At times this may be more than once and it may also happen for multiple users in a row.
What would be the best / safest method (in your opinion) of capturing the password at the start of the script and then delivering it when required?I have looked at expect ( I am not at all familiar ), but on the examples dealing with passwords, that I could find, they all seem to store the password in a simple bash like variable (which does not excite me at all from a security point).I can also potentially go down the sudo road, but the issue here is that I would either have to find a list of commands that an entire group can have access to without passwords (doesn't sound safe) or I am back to square one of then requiring a password for each individual user to be entered, which if at the start would still need to be captured and saved until necessary.So as I have said, I am open to any and all (constructive) advice
View 14 Replies
View Related
Jun 24, 2011
I've encountered a problem when running a simple bit of code, I'm using c to read write data to a binary file. It works fine when I run as root. However when I run as a user it produces the file, however when I try to open / write after it's produced it caused a seg fault. Is there any reason file functions ( fopen etc ) would work for root and not a user and is there a way to fix this?
View 14 Replies
View Related
Jan 23, 2010
This is the case. I run openSUSE 11.2 with GNOME. I want my desktop wallpaper to automatically cycle on a fixed interval. So I found this script (change-background.py), edited it to match my needs, and put it in my home bin directory. The script runs fine.
change-background.py
Code:
#!/usr/bin/env python
#
# change-background.py
#
#
[Code]....
View 6 Replies
View Related
Jul 27, 2009
I've compiled some code which I've given to other people, however when they try to run it they get segemtation fault. After some testing I've found if it's ran from root (where I compiled it) everything works, if I try to run from a user there's a fault.
View 3 Replies
View Related
Mar 22, 2010
Is there any way a non-root user can programmatically determine which days the computer ran during, say, the last month?
The information is in /var/log/messages.* but those files are root:root 640.
Non of the world-readable /var/log files on the Slackware 13.0 development system can be used:boot Not present if boot logging not enabled (default). dmesg No timestamps. lastlog Not enough info. wtmp Rewritten on each boot so not enough info. EDIT: not correct: by default wtmp is rotated weekly and kept for one month as configured in /etc/logrotate.conf xdm.log Not present if xdm not used. Xorg.0.log Not present if X not run.
View 5 Replies
View Related
Jun 30, 2011
I am writing a ping kind of program for my own application. This application needs to run with non root user privileges. This needs me to create a raw socket. But the ping connection is failing because of creating raw socket with non root user.How can I run the application successfully with non root user privileges using raw socket creation?
View 4 Replies
View Related
Aug 1, 2010
I'm trying to use buildroot to cross compile some libraries for me. To do so I've set up build root to point to my working tool chain in the menuconfig.All seems fine however when I try to make (buildroot) I get the following error
rm -rf /root/buildroot-2010.05/output/build/buildroot-config
mkdir -p /root/buildroot-2010.05/output/build
cp -dpRf package/config/buildroot-config /root/buildroot-2010.05/output/build/buildroot-config
Checking external toolchain settings
Incorrect selection of the C library
make: *** [/root/buildroot-2010.05/output/stamps/ext-toolchain-installed] Error 255
I know it's pointing to the correct files and gcc as any wrong paths are reported in make menuconfig.
View 1 Replies
View Related
Jan 12, 2011
I am working on a large program in C to run on Puppy Linux. I have multiple pthreads running. I want to be able to set the pthread SCHED_POLICY and priority in my program but I want a user to be able to run the program without root privilege.
Using a sticky bit and root ownership gives the user too much power because they will be able to write and compile their own scripts. Is there a way to use 'sudo' when I set the thread parameters from my program or something like this?
View 1 Replies
View Related
Jan 8, 2011
One of the feature in my application involve changing of hardware setting. This require the user to be root or have administrative right.Before my application enable that feature, I want it to check whether the user is "root" or not, or whether user use "sudo" command to run the application or not, or whether the user has administrative rights or not.What are the codes or library that can do this?
NOTE: Sometimes, advanced linux user may set the user id of root to something else other than 0. So, getuid() may not be helpful in this case.
View 4 Replies
View Related
Aug 1, 2011
ccess to an iso file in chroot environment from my usual root (/) env..
Within the chroot environment I have an iso file placed... In my program I need to access this iso file and perform mount and other operations.. But I cant do this in the chroot environment as I have only basic commands here (ls,cp etc.. and no mount)
So how can I access this iso file from my program ? Is there something like a file-descriptor which I can associate with the file exit from the chroot env and access the file via this fd ?
View 6 Replies
View Related
Sep 4, 2009
Is suid disabled from running all home made bash scripts or just from running them as root or:
Who would know for sure.
I googled several combinations of Mandriva Linux how-to suid disabled setUID etc... so far all I found was "many distributions are disabling suid for security reasons" nothing specific.
View 2 Replies
View Related
Feb 11, 2011
I am trying to install a printer driver on an amd64 that was designed for 32bit only (of course)Squeeze automaticallty installed the ia32_libs package, but it may not be enough.How can I tell which library is failing?I do get an error on libcupsimage.so.2 but it does exist in /usr/lib/libcupsimage.so.2
View 4 Replies
View Related
Jan 20, 2010
I am new here and Fedora. Currently running Fedora 12 and recieved kernel crashes to which error report shows failure with IPv6.
I have disabled Ipv6 in /etc/sysconfig/network, blacklisted and stop these services.
However why is my Ipv6 failing?
View 2 Replies
View Related
Feb 9, 2011
After installing QtCurve 1.8-41 from software.opensuse (I've been playing around with themes), whenever I try to boot my computer, it gets to stage 1 of loading (the less colorful splash screen), and about halfway through loading that, the screen goes black and a box in the top left corner says: "Could not start kdeinit4. Check your installation". I'm then taken to failsafe, where I login. When I try to run kdeinit4 from the command line, I get this error:
kdeinit 4: symbol lookup error: /usr/lib/libQtSvg.so.4: undefined symbol: _ZN14QObjectPrivate15checkWindowRoleEv.
I've tried uninstalling through zypper, but it can never find the package I specify. I'm on 11.3.
View 9 Replies
View Related
Aug 15, 2010
recently logging in become a bit unreliable - i thought i was mis-typing the passwords but on closer looking the passwords were ok (faulty passwords produces "authentication failure) Using the correct passwords the screen blanks for a second and then returns to the list of possible logins. I cannot log in except as one of the children - could this be because their logins have been used less often and less recently Everything was working well and I have not knowingly changed anything except the passwords after the problems started in order to solve what i thought was a simple mis-typing problem
I can log in as the children but their logins obviously do not have permission to do much
I also have a bootable puppy CD Unfortunately I am also a total noob but determined not to backslide into XP because up to now Ubuntu has been fantastic
View 9 Replies
View Related
Feb 28, 2011
I am attempting to install Ubuntu 64-bit and it keeps failing. This is my first 64-bit system, and have not had problems with installing x86 Ubuntu in the past. When the full install failed, I tried installing it within Windows and that also failed. I've attached the log from that attempt in this post (had to trim it down to fit the file limit though). I don't know if these are the same errors I was getting on full install as I didn't write those errors down...I can try again and post them if needed though.
View 4 Replies
View Related