Startup script needs root permissions Announcing the arrival of Valued Associate #679: Cesar...
What would you call this weird metallic apparatus that allows you to lift people?
Mounting TV on a weird wall that has some material between the drywall and stud
Tannaka duality for semisimple groups
One-one communication
Printing attributes of selection in ArcPy?
Monty Hall Problem-Probability Paradox
Is there hard evidence that the grant peer review system performs significantly better than random?
A `coordinate` command ignored
I can't produce songs
What initially awakened the Balrog?
Delete free apps from library
Central Vacuuming: Is it worth it, and how does it compare to normal vacuuming?
Does the Mueller report show a conspiracy between Russia and the Trump Campaign?
How much damage would a cupful of neutron star matter do to the Earth?
Why datecode is SO IMPORTANT to chip manufacturers?
Is CEO the "profession" with the most psychopaths?
What is the origin of 落第?
Does silver oxide react with hydrogen sulfide?
Random body shuffle every night—can we still function?
License to disallow distribution in closed source software, but allow exceptions made by owner?
What is the chair depicted in Cesare Maccari's 1889 painting "Cicerone denuncia Catilina"?
What are the main differences between Stargate SG-1 cuts?
A proverb that is used to imply that you have unexpectedly faced a big problem
What is the difference between a "ranged attack" and a "ranged weapon attack"?
Startup script needs root permissions
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
2019 Community Moderator Election Results
Why I closed the “Why is Kali so hard” questionExecute user script as root in startup applicationschkconfig bootup script failing, script runs good manuallyHow secure is keeping non-root owned scripts in /etc/init.d?Daemon - how to tell the start daemon to execute this daemon as different username than root?Startup script with LSB headers not working correctly (dependency problem)?init.d script is not starting under virtualboxCreating a shutdown only script with update-rc.dInit script for a daemon to run screens on CentOSStart process at startupRun shell script at startup (Kali Linux)
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I have a script that I need to run at startup. I have it in init.d. I need to execute one of the commands within the script with root permissions. How do I go about doing this?
Edit 1:
For reference, this is a ClearCase/ClearQuest RHEL 6.7 server. There looks to be an issue relating to CC starting before the license manager. So, I want to run the following (all requiring root permissions):
/path/to/atria_start stop # stop CC
/path/to/start_lmgrd start # start license manager (flexlm)
/path/to/atria_start start # restart CC
These don't happend. I have them in a simple script "cc_startup.sh" in /etc/init.d
startup init-script init init.d
bumped to the homepage by Community♦ 2 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I have a script that I need to run at startup. I have it in init.d. I need to execute one of the commands within the script with root permissions. How do I go about doing this?
Edit 1:
For reference, this is a ClearCase/ClearQuest RHEL 6.7 server. There looks to be an issue relating to CC starting before the license manager. So, I want to run the following (all requiring root permissions):
/path/to/atria_start stop # stop CC
/path/to/start_lmgrd start # start license manager (flexlm)
/path/to/atria_start start # restart CC
These don't happend. I have them in a simple script "cc_startup.sh" in /etc/init.d
startup init-script init init.d
bumped to the homepage by Community♦ 2 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
1
Scripts run by the init system are already running as root. Do you need to run a portion of the script as a normal user?
– jecxjo
Jan 27 '16 at 19:50
add a comment |
I have a script that I need to run at startup. I have it in init.d. I need to execute one of the commands within the script with root permissions. How do I go about doing this?
Edit 1:
For reference, this is a ClearCase/ClearQuest RHEL 6.7 server. There looks to be an issue relating to CC starting before the license manager. So, I want to run the following (all requiring root permissions):
/path/to/atria_start stop # stop CC
/path/to/start_lmgrd start # start license manager (flexlm)
/path/to/atria_start start # restart CC
These don't happend. I have them in a simple script "cc_startup.sh" in /etc/init.d
startup init-script init init.d
I have a script that I need to run at startup. I have it in init.d. I need to execute one of the commands within the script with root permissions. How do I go about doing this?
Edit 1:
For reference, this is a ClearCase/ClearQuest RHEL 6.7 server. There looks to be an issue relating to CC starting before the license manager. So, I want to run the following (all requiring root permissions):
/path/to/atria_start stop # stop CC
/path/to/start_lmgrd start # start license manager (flexlm)
/path/to/atria_start start # restart CC
These don't happend. I have them in a simple script "cc_startup.sh" in /etc/init.d
startup init-script init init.d
startup init-script init init.d
edited Jan 28 '16 at 15:26
basil
asked Jan 27 '16 at 19:47
basilbasil
1113
1113
bumped to the homepage by Community♦ 2 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 2 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
1
Scripts run by the init system are already running as root. Do you need to run a portion of the script as a normal user?
– jecxjo
Jan 27 '16 at 19:50
add a comment |
1
Scripts run by the init system are already running as root. Do you need to run a portion of the script as a normal user?
– jecxjo
Jan 27 '16 at 19:50
1
1
Scripts run by the init system are already running as root. Do you need to run a portion of the script as a normal user?
– jecxjo
Jan 27 '16 at 19:50
Scripts run by the init system are already running as root. Do you need to run a portion of the script as a normal user?
– jecxjo
Jan 27 '16 at 19:50
add a comment |
3 Answers
3
active
oldest
votes
If it's in init.d then it should be running as root. If you want it to run at start up then place it in for example /etc/rc.d/rc2.d or /etc/rc2.d depending upon your OS distro/version. You'll want to create a link in the following format for example:
S##Name -> ../init.d/scripthere.sh wherein ## is equivalent to when you want it to run at start up. Do you want it coming up before ssh? After apache? Before your database? etc etc. Knowing that will tell you which numbers to put in.
To achieve this you'll want to run ln -s ../init.d/scripthere.sh S##name from the proper rc directory.
Edit 1 expounds on what I would like to do. I am not sure what you are getting up wrt script numbering. I suppose it could run at the very end.
– basil
Jan 28 '16 at 15:28
add a comment |
If you are creating your own init script on RH and derived distros then you should really write it to use the default chkconfig startup configuration utility (as that is what almost all RHL admins know and use).
The following covers the basics quite well.
Creating a new chkconfig init script
add a comment |
I have tested it in Bash, but not in other shells. if want to make this work on your machine only. You can use the following:
echo $MY_SUDO_PASSWORD | sudo -S <command>
This will run under sudo without prompting for password, if $MY_SUDO_PASSWORD matches your sudo password of course.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f258095%2fstartup-script-needs-root-permissions%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
If it's in init.d then it should be running as root. If you want it to run at start up then place it in for example /etc/rc.d/rc2.d or /etc/rc2.d depending upon your OS distro/version. You'll want to create a link in the following format for example:
S##Name -> ../init.d/scripthere.sh wherein ## is equivalent to when you want it to run at start up. Do you want it coming up before ssh? After apache? Before your database? etc etc. Knowing that will tell you which numbers to put in.
To achieve this you'll want to run ln -s ../init.d/scripthere.sh S##name from the proper rc directory.
Edit 1 expounds on what I would like to do. I am not sure what you are getting up wrt script numbering. I suppose it could run at the very end.
– basil
Jan 28 '16 at 15:28
add a comment |
If it's in init.d then it should be running as root. If you want it to run at start up then place it in for example /etc/rc.d/rc2.d or /etc/rc2.d depending upon your OS distro/version. You'll want to create a link in the following format for example:
S##Name -> ../init.d/scripthere.sh wherein ## is equivalent to when you want it to run at start up. Do you want it coming up before ssh? After apache? Before your database? etc etc. Knowing that will tell you which numbers to put in.
To achieve this you'll want to run ln -s ../init.d/scripthere.sh S##name from the proper rc directory.
Edit 1 expounds on what I would like to do. I am not sure what you are getting up wrt script numbering. I suppose it could run at the very end.
– basil
Jan 28 '16 at 15:28
add a comment |
If it's in init.d then it should be running as root. If you want it to run at start up then place it in for example /etc/rc.d/rc2.d or /etc/rc2.d depending upon your OS distro/version. You'll want to create a link in the following format for example:
S##Name -> ../init.d/scripthere.sh wherein ## is equivalent to when you want it to run at start up. Do you want it coming up before ssh? After apache? Before your database? etc etc. Knowing that will tell you which numbers to put in.
To achieve this you'll want to run ln -s ../init.d/scripthere.sh S##name from the proper rc directory.
If it's in init.d then it should be running as root. If you want it to run at start up then place it in for example /etc/rc.d/rc2.d or /etc/rc2.d depending upon your OS distro/version. You'll want to create a link in the following format for example:
S##Name -> ../init.d/scripthere.sh wherein ## is equivalent to when you want it to run at start up. Do you want it coming up before ssh? After apache? Before your database? etc etc. Knowing that will tell you which numbers to put in.
To achieve this you'll want to run ln -s ../init.d/scripthere.sh S##name from the proper rc directory.
answered Jan 27 '16 at 22:41
SpaceLourdeSpaceLourde
161
161
Edit 1 expounds on what I would like to do. I am not sure what you are getting up wrt script numbering. I suppose it could run at the very end.
– basil
Jan 28 '16 at 15:28
add a comment |
Edit 1 expounds on what I would like to do. I am not sure what you are getting up wrt script numbering. I suppose it could run at the very end.
– basil
Jan 28 '16 at 15:28
Edit 1 expounds on what I would like to do. I am not sure what you are getting up wrt script numbering. I suppose it could run at the very end.
– basil
Jan 28 '16 at 15:28
Edit 1 expounds on what I would like to do. I am not sure what you are getting up wrt script numbering. I suppose it could run at the very end.
– basil
Jan 28 '16 at 15:28
add a comment |
If you are creating your own init script on RH and derived distros then you should really write it to use the default chkconfig startup configuration utility (as that is what almost all RHL admins know and use).
The following covers the basics quite well.
Creating a new chkconfig init script
add a comment |
If you are creating your own init script on RH and derived distros then you should really write it to use the default chkconfig startup configuration utility (as that is what almost all RHL admins know and use).
The following covers the basics quite well.
Creating a new chkconfig init script
add a comment |
If you are creating your own init script on RH and derived distros then you should really write it to use the default chkconfig startup configuration utility (as that is what almost all RHL admins know and use).
The following covers the basics quite well.
Creating a new chkconfig init script
If you are creating your own init script on RH and derived distros then you should really write it to use the default chkconfig startup configuration utility (as that is what almost all RHL admins know and use).
The following covers the basics quite well.
Creating a new chkconfig init script
answered Jan 28 '16 at 15:37
SkyLeachSkyLeach
1463
1463
add a comment |
add a comment |
I have tested it in Bash, but not in other shells. if want to make this work on your machine only. You can use the following:
echo $MY_SUDO_PASSWORD | sudo -S <command>
This will run under sudo without prompting for password, if $MY_SUDO_PASSWORD matches your sudo password of course.
add a comment |
I have tested it in Bash, but not in other shells. if want to make this work on your machine only. You can use the following:
echo $MY_SUDO_PASSWORD | sudo -S <command>
This will run under sudo without prompting for password, if $MY_SUDO_PASSWORD matches your sudo password of course.
add a comment |
I have tested it in Bash, but not in other shells. if want to make this work on your machine only. You can use the following:
echo $MY_SUDO_PASSWORD | sudo -S <command>
This will run under sudo without prompting for password, if $MY_SUDO_PASSWORD matches your sudo password of course.
I have tested it in Bash, but not in other shells. if want to make this work on your machine only. You can use the following:
echo $MY_SUDO_PASSWORD | sudo -S <command>
This will run under sudo without prompting for password, if $MY_SUDO_PASSWORD matches your sudo password of course.
answered Jan 28 '16 at 16:30
ErectCrestedErectCrested
588
588
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f258095%2fstartup-script-needs-root-permissions%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Scripts run by the init system are already running as root. Do you need to run a portion of the script as a normal user?
– jecxjo
Jan 27 '16 at 19:50