Sponsored Content
Top Forums UNIX for Advanced & Expert Users Run compile command make as another user Post 302993125 by apmcd47 on Tuesday 7th of March 2017 05:52:55 AM
Old 03-07-2017
Quote:
Originally Posted by go4bash
Hello


Then I try to run the compile commands using sudo -u. And it fails.

I'm not an experienced bash user. But I realized that some environment variables doesn't come from anotheruser but from the login user that starts the command sudo -u. So when I run (as login user)

Code:
sudo -u lool /bin/bash -c "echo `id -u`"

the id of the login user is returned and not the id of anotheruser. Why?

Any hints are welcome. Kind regards.
You should be using code tags to separate the code fragments from the rest of your post.

The problem is you are doing:
Code:
echo `id -u`

which is a completely superfluous use of echo in this case. It looks to me as though the part in back-ticks (`id -u`) is being processed by the parent shell before being sent to the sudo sub-process. Try
Code:
sudo -u lool /bin/bash -c "id -u"

instead.

Andrew
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to run a command with some other user id

Hi Say I am running a script using my user id csaha. How can I run any specific command in the same sctipr using any other user id (say root). Definitely I have the password of root. Any idea how the same can be achieved ??? Example: I need to run a script using my id (csaha) only on... (4 Replies)
Discussion started by: csaha
4 Replies

2. Shell Programming and Scripting

who to compile needed libs with Make

Hello all my project is contains 2 directories, 2 directories are building library and one for the executable that using the libes from the other 2 Now what im doing is compiling first the 2 libs directories and then the main directory. But I will like to automate the process and to be able ... (0 Replies)
Discussion started by: umen
0 Replies

3. UNIX for Dummies Questions & Answers

how can i make sar command run forever ?

Hello all i found out about the sar command but when looking in the man pages there is no way to make sar working for ever .. only with some kind of interval . like sar 2 30 . my question is can i just run sar for ever ? (5 Replies)
Discussion started by: umen
5 Replies

4. AIX

run which command to check the actual user

hi gurus, i have a question: when run which javac under a user account I got the following results: PROD DB Server: /usr/java14/bin/javac DR DB Server: /usr/java14/bin/javac DEV DB Server: /usr/java5_64/bin/javac The .profile in all environments are same. so how do know who is the... (1 Reply)
Discussion started by: lweegp
1 Replies

5. Shell Programming and Scripting

how to run script? call other script? su to another user? make a cron?

Good morning. I am searching for "how-to"'s for some particular questions: 1. How to write a script in HP-UX 11. 2. How to schedule a script. 3. How to "call" scripts from the original script. 4. How to su to another user from within a script. This is the basics of what the... (15 Replies)
Discussion started by: instant000
15 Replies

6. UNIX for Advanced & Expert Users

How can I run command with super user privledge

Hello All, I am working on UNIX like environment. This environment is ported from UNIX. Here when we need to build product set, we need to run some script with super user privledge (which we normal user dont have) Is there any way (some C program or some script) through which any normal... (2 Replies)
Discussion started by: joshi123
2 Replies

7. HP-UX

Make command performs badly and refuses to compile on 200000 files

I am trying to run make command on 200000 files in HP UX but it refuses to compile giving a message that " command line is too long .stop" I checked and found out that there is a limit imposed by the operating system on the command line .for Eg refer following link : The maximum length of... (6 Replies)
Discussion started by: madhur.tripathi
6 Replies

8. UNIX for Dummies Questions & Answers

Compiling gcc to compile make to compile yaboot

I have just installed OpenBSD on a 333MHz PPC iMac G3. It has a 6GB HDD that has been partitioned as 1GB MacOS 8.5.1, 3GB MacOS X 10.3.9, 2GB OpenBSD 4.8. I now need to install a bootloader so that my computer can recognize the OpenBSD partition at startup. I have been trying to install... (0 Replies)
Discussion started by: t04st3r
0 Replies

9. Shell Programming and Scripting

how to run a command as soon as user exits from session

I need to write a script, where I have to get names of files that are to be deleted from a user and have to delete those files when he exits session. How to set a particular command to be run as soon as user exits from a session? Can somebody help? I have to write a script on linux system.... (3 Replies)
Discussion started by: yashashri
3 Replies

10. Shell Programming and Scripting

tuxedo command run from another user

Hi , I would like to know, whether if it is possible or not. I am runing one tuxedo command script. This script should run on another userID and stored the data on another UserID. For Example: UserA : The Script is available in this userID location. . If i run that script then it... (3 Replies)
Discussion started by: Mani_apr08
3 Replies
ICECREAM 
DAEMON(1) Icecream User's Manual ICECREAM DAEMON(1) NAME
iceccd - Icecream daemon SYNOPSIS
iceccd [-n netname] [-m max_processes] [--no-remote] [-w] [-d | --daemonize] [-l logfile] [-s schedulerhost] [-v [v [v]]] [-r | --run-as-user] [-b env-basedir] [-u | --nobody-uid nobodyuid] [--cache-limit MB] [-N hostname] DESCRIPTION
The Icecream daemon has to run on all nodes being part of the Icecream compile cluster. It receives compile jobs and executes them in a ch- root environment. The compile clients send their compile environment the first time they send a job to a particular daemon, so that the en- vironment of the daemon doesn't have to match the one of the client. The daemon also has to run on clients sending compile jobs to the Icecream network. If a node should be able to send compile jobs, but nev- er receive any, start the daemon with the option -m 0. All Icecream daemons need to have contact to the Icecream scheduler which controls the distribution of data between compile nodes. Normally the daemon will automatically find the right scheduler. If this is not the case you can explicitly specify the name of the Icecream network and the host running the scheduler. OPTIONS
-n netname The name of the icecream network the daemon should connect to. There has to be a scheduler running for the network under the same network name. -m max_processes Maximum number of compile jobs started in parallel on machine running the daemon. --no-remote Prevents jobs from other nodes being scheduled on this one. -w -d, --daemonize Detach daemon from shell. -l logfile Name of file where log output is written to. -s scheduler_host Name of host running the scheduler for the network the daemon should connect to. This option might help if the scheduler can't broadcast its presence to the clients due to firewall settings or similar reasons. -v, -vv, -vvv Control verbosity of daemon. The more v the more verbose. -r, --run-as-user Force running the daemon with user rights. Usually you will need to run the daemon with root rights. -b env_basedir Base directory for storing compile environments sent to the daemon by the compile clients. -u, --nobody-uid nobodyuid Id of user nobody. This user id is used when the daemon is dropping privileges. --cache-limit MB Maximum size in Mega Bytes of cache used to store compile environments of compile clients. -N hostname The name of the icecream host on the network. SEE ALSO
icecream, scheduler, iceccd, icemon AUTHOR
Cornelius Schumacher Icecream April 21th, 2005 ICECREAM DAEMON(1)
All times are GMT -4. The time now is 03:08 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy