unix

In a Java thread running as root, how can we apply Unix rights specific to a logged-in user ?

We have a Java program run as root on Unix, that therefore can read for example the content of the folders /home/user1 and /home/user2. However, if the Unix user "user1" is logged in in our application, he should not be able to access "/home/user2" data. We would like to use directly the Unix rights and not recreate all the permissions ...

Can one setup dev/random when using a VM(virtual machine)?

Does anyone know if it's possible to setup dev/random when running the OS within a VM (VMWare in this case)? ...

Unix C Shell Scripting printf help

Attempting to print out a list of values from 2 different variables that are aligned correctly. foreach finalList ($correctList $wrongList) printf "%20s%s\n" $finalList end This prints them out an they are aligned, but it's one after another. How would I have it go through each item in each list and THEN go to a new line? I want t...

Changing the ownership / permissions of a semaphore

Is there any way to change the ownership and permission mask for a semaphore on Unix systems directly from the command prompt, without deploying a special program that calls semctl with the IPC_SET option? ...

Using '__progname' instead of argv[0]

In the C / Unix environment I work in, I see some developers using __progname instead of argv[0] for usage() messages. Is there some advantage to this? What's the difference between __progname and argv[0]. Is it portable? ...

How Is "Unix Network Programming" (two volumes)?

I've seen these books mentioned elsewhere on SO, but no detailed discussion. To better position my question... I own and frequently return to Advanced Programming in the UNIX Environment, now in it's second edition. It's a huge book, and for the material it covers, I've found it to be just great. I like the discussion of cross-platform ...

How do I manipulate $PATH elements in shell scripts?

Is there a idiomatic way of removing elements from PATH-like shell variables? That is I want to take PATH=/home/joe/bin:/usr/local/bin:/usr/bin:/bin:/path/to/app/bin:. and remove or replace the /path/to/app/bin without clobbering the rest of the variable. Extra points for allowing me put new elements in arbitrary positions. The targe...

System Calls: UNIX, Linux, BSD and Solaris variations

Are there differences between the amount of syscalls in the major *NIX variants ? Which syscalls would be supported universally ? ...

how to use the unix "find" command to find all the cpp and h files?

I know that to find all the h files I need to use: find . -name "*.h" but how to find all the h AND cpp files? ...

Why do various Linux distros use different package managers?

Why do Linux distros have different package managers? I find this very strange because other software such as text editors, desktop environments and graphics software (Inkscape, Blender, GIMP) are shared among distributions. Why not have a common setup tool? ...

What was your biggest *nix blooper?

So I was thinking about bloopers I've made or have seen made in a *nix systems and was wondering what others think the worst blooper they made was? I couldn't find a similar question already asked but I can't believe this isn't a copy question but then again may users are so perfect the idea of a blooper is impossible. Fire away. ...

How to set (unix) permissions when creating a file in SAP ABAP?

you would think this would be obvious, but searching through documentation, SAP forums, Googling, etc., I've been spectacularly unsuccessful. I'm creating a file in ABAP on a solaris filesystem using the following code: OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT. the resulting file is owned and grouped according to ...

How to download/install pre-compiled Subversion binaries for Debian

Been trying to upgrade my subversion installation, but due to (what I believe) are limited rights (I'm using hosted Linux account), I'm not able to properly "./configure" and compile the source code (see posts Post1 and Post2 if very interested) So, I'm thinking if I could just download pre-compiled binaries, the just might solve my pro...

file path portability

I have a program that I need to run under *nix and windows. because the program takes file paths from files the issue is what to do about the \ vs / issue. My current thought is to put in a regex that converts the wrong one to the right one depending on what system I'm on. This will have the effect of letting either type work on either...

How do you see the STDOUT of a child process in the calling parent process in csh script

I am calling a csh script that the first thing it does is starts a new group. I need to be able to see the standard output from the child process that is executed after the fork. I also want the parent process to 'hang' unitl the child process is finished. Here is the script (razor_from_cgwin.sh). (sort of) newgrp name source /stuf...

Using dlsym and adding -ldl to flags

I am trying to write a C program that uses dlysm, and I keep getting an undefined deference to dlysm. I think I need to set my -ldl flags but I have no idea how to do this. I am very new to linux and setting variables. If this is what I need to do can someone help me out with the commands? ...

how to control popen stdin, stdout, stderr redirection?

I am confused about how popen() redirects stdin, stdout and stderr of the child process in unix. The man page on popen() is not very clear in this regard. The call FILE *p = popen("/usr/bin/foo", "w"); forks a child process and executes a shell with arguments "-c", "/usr/bin/foo", and redirects stdin of this shell (which is redirected...

Where does '.' and '..' come from?

What's the story behind our massive repitition of './foo' and 'cd ..'. Where do these two '.' and '..' come from? Where could they be seen as a way of navigating a file system tree for the first time? I seem to have formulated this question a bit vague. Answers to earliest reference have been found, however, the question remains to why ...

SQL select statement in UNIX inside/within IF..THEN statement.

Hi - I just want ask the steps when trying to create a simple SQL select statement in UNIX inside/within IF..THEN..FI statement. I know how to use the 'select' and 'if..then' statements in SQL*Plus, but I'm having a difficulties having a UNIX script to point to variables: If 'ABC' to 'Select...' Example: if [ "$?" = 'ABC' ] then ...

How to make child process die after parent exits?

Suppose I have a process which spawns exactly one child process. Now when the parent process exits for whatever reason (normally or abnormally, by kill, ^C, assert failure or anything else) I want the child process to die. How to do that correctly? Some similar question on stackoverflow: (asked earlier) http://stackoverflow.com/ques...