What user runs the commands defined in /etc/rc.local?
Are the commands in /etc/rc.local ran by su by default?
Do I need to specific sudo before each command or will they be ran by su regardless?
linux sudo startup su
migrated from serverfault.com Jun 20 '15 at 3:26
This question came from our site for system and network administrators.
add a comment |
Are the commands in /etc/rc.local ran by su by default?
Do I need to specific sudo before each command or will they be ran by su regardless?
linux sudo startup su
migrated from serverfault.com Jun 20 '15 at 3:26
This question came from our site for system and network administrators.
add a comment |
Are the commands in /etc/rc.local ran by su by default?
Do I need to specific sudo before each command or will they be ran by su regardless?
linux sudo startup su
Are the commands in /etc/rc.local ran by su by default?
Do I need to specific sudo before each command or will they be ran by su regardless?
linux sudo startup su
linux sudo startup su
edited Jun 5 '18 at 15:16
schily
10.6k31641
10.6k31641
asked Jun 18 '15 at 16:54
S-K'
148114
148114
migrated from serverfault.com Jun 20 '15 at 3:26
This question came from our site for system and network administrators.
migrated from serverfault.com Jun 20 '15 at 3:26
This question came from our site for system and network administrators.
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
su is not a user it's program to run subsequent commands/programs under an alternate identity of another user than the one executing the command. It is very similar to sudo in that regard.
Unless another user is specified both commands will default to running the command under the alternate identity of the root user, the superuser/administrator.
The main difference between su and sudo is that:
surequires you to know the password of that alternate user, where
sudowill prompt for the password of the user running thesudocommand and requires setup so that the user is allowed to run the requested commands/programs.
(When root runs either su or sudo no password is required.)
Like any init script, the /etc/rc.local script is executed by the root user and you do not need to prepend either su or sudo to the commands/programs that need to run as root.
You may still need to use su or sudo in your init scripts if those commands need to be executed not as root but another user/service-account...
su -oracle/do/something/as/oracle/user
What do I do if I put su - user /path/to/script.sh in rc.local, and when sourcing it it prompts me for the user password (and closes the terminal afterwards). How do I make it not ask me for the user's password?
– alonso s
Jan 3 '18 at 1:40
add a comment |
Yes, all the scripts and programs are directly called by root.
The /etc/rc.local file is called directly by the init process.
So then, we didn't need to addsudobefore commands in/etc/rc.local?
– Benyamin Jafari
Jun 5 '18 at 14:59
add a comment |
Im not sure what im missing but hoping for some help. I need to run this command line at startup
echo 1 > /sys/module/bluetooth/parameters/disable_ertm
when I go to terminal type SU enter my password type that command it works perfectly, yet when i add that line the /etc/rc.local
echo 1 > /sys/module/bluetooth/parameters/disable_ertm before the exit 0 it does nothing at all....
New contributor
Steve is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
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%2f210939%2fwhat-user-runs-the-commands-defined-in-etc-rc-local%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
su is not a user it's program to run subsequent commands/programs under an alternate identity of another user than the one executing the command. It is very similar to sudo in that regard.
Unless another user is specified both commands will default to running the command under the alternate identity of the root user, the superuser/administrator.
The main difference between su and sudo is that:
surequires you to know the password of that alternate user, where
sudowill prompt for the password of the user running thesudocommand and requires setup so that the user is allowed to run the requested commands/programs.
(When root runs either su or sudo no password is required.)
Like any init script, the /etc/rc.local script is executed by the root user and you do not need to prepend either su or sudo to the commands/programs that need to run as root.
You may still need to use su or sudo in your init scripts if those commands need to be executed not as root but another user/service-account...
su -oracle/do/something/as/oracle/user
What do I do if I put su - user /path/to/script.sh in rc.local, and when sourcing it it prompts me for the user password (and closes the terminal afterwards). How do I make it not ask me for the user's password?
– alonso s
Jan 3 '18 at 1:40
add a comment |
su is not a user it's program to run subsequent commands/programs under an alternate identity of another user than the one executing the command. It is very similar to sudo in that regard.
Unless another user is specified both commands will default to running the command under the alternate identity of the root user, the superuser/administrator.
The main difference between su and sudo is that:
surequires you to know the password of that alternate user, where
sudowill prompt for the password of the user running thesudocommand and requires setup so that the user is allowed to run the requested commands/programs.
(When root runs either su or sudo no password is required.)
Like any init script, the /etc/rc.local script is executed by the root user and you do not need to prepend either su or sudo to the commands/programs that need to run as root.
You may still need to use su or sudo in your init scripts if those commands need to be executed not as root but another user/service-account...
su -oracle/do/something/as/oracle/user
What do I do if I put su - user /path/to/script.sh in rc.local, and when sourcing it it prompts me for the user password (and closes the terminal afterwards). How do I make it not ask me for the user's password?
– alonso s
Jan 3 '18 at 1:40
add a comment |
su is not a user it's program to run subsequent commands/programs under an alternate identity of another user than the one executing the command. It is very similar to sudo in that regard.
Unless another user is specified both commands will default to running the command under the alternate identity of the root user, the superuser/administrator.
The main difference between su and sudo is that:
surequires you to know the password of that alternate user, where
sudowill prompt for the password of the user running thesudocommand and requires setup so that the user is allowed to run the requested commands/programs.
(When root runs either su or sudo no password is required.)
Like any init script, the /etc/rc.local script is executed by the root user and you do not need to prepend either su or sudo to the commands/programs that need to run as root.
You may still need to use su or sudo in your init scripts if those commands need to be executed not as root but another user/service-account...
su -oracle/do/something/as/oracle/user
su is not a user it's program to run subsequent commands/programs under an alternate identity of another user than the one executing the command. It is very similar to sudo in that regard.
Unless another user is specified both commands will default to running the command under the alternate identity of the root user, the superuser/administrator.
The main difference between su and sudo is that:
surequires you to know the password of that alternate user, where
sudowill prompt for the password of the user running thesudocommand and requires setup so that the user is allowed to run the requested commands/programs.
(When root runs either su or sudo no password is required.)
Like any init script, the /etc/rc.local script is executed by the root user and you do not need to prepend either su or sudo to the commands/programs that need to run as root.
You may still need to use su or sudo in your init scripts if those commands need to be executed not as root but another user/service-account...
su -oracle/do/something/as/oracle/user
answered Jun 19 '15 at 7:31
HBruijn
5,5061525
5,5061525
What do I do if I put su - user /path/to/script.sh in rc.local, and when sourcing it it prompts me for the user password (and closes the terminal afterwards). How do I make it not ask me for the user's password?
– alonso s
Jan 3 '18 at 1:40
add a comment |
What do I do if I put su - user /path/to/script.sh in rc.local, and when sourcing it it prompts me for the user password (and closes the terminal afterwards). How do I make it not ask me for the user's password?
– alonso s
Jan 3 '18 at 1:40
What do I do if I put su - user /path/to/script.sh in rc.local, and when sourcing it it prompts me for the user password (and closes the terminal afterwards). How do I make it not ask me for the user's password?
– alonso s
Jan 3 '18 at 1:40
What do I do if I put su - user /path/to/script.sh in rc.local, and when sourcing it it prompts me for the user password (and closes the terminal afterwards). How do I make it not ask me for the user's password?
– alonso s
Jan 3 '18 at 1:40
add a comment |
Yes, all the scripts and programs are directly called by root.
The /etc/rc.local file is called directly by the init process.
So then, we didn't need to addsudobefore commands in/etc/rc.local?
– Benyamin Jafari
Jun 5 '18 at 14:59
add a comment |
Yes, all the scripts and programs are directly called by root.
The /etc/rc.local file is called directly by the init process.
So then, we didn't need to addsudobefore commands in/etc/rc.local?
– Benyamin Jafari
Jun 5 '18 at 14:59
add a comment |
Yes, all the scripts and programs are directly called by root.
The /etc/rc.local file is called directly by the init process.
Yes, all the scripts and programs are directly called by root.
The /etc/rc.local file is called directly by the init process.
answered Jun 18 '15 at 16:58
dmourati
23613
23613
So then, we didn't need to addsudobefore commands in/etc/rc.local?
– Benyamin Jafari
Jun 5 '18 at 14:59
add a comment |
So then, we didn't need to addsudobefore commands in/etc/rc.local?
– Benyamin Jafari
Jun 5 '18 at 14:59
So then, we didn't need to add
sudo before commands in /etc/rc.local?– Benyamin Jafari
Jun 5 '18 at 14:59
So then, we didn't need to add
sudo before commands in /etc/rc.local?– Benyamin Jafari
Jun 5 '18 at 14:59
add a comment |
Im not sure what im missing but hoping for some help. I need to run this command line at startup
echo 1 > /sys/module/bluetooth/parameters/disable_ertm
when I go to terminal type SU enter my password type that command it works perfectly, yet when i add that line the /etc/rc.local
echo 1 > /sys/module/bluetooth/parameters/disable_ertm before the exit 0 it does nothing at all....
New contributor
Steve is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
Im not sure what im missing but hoping for some help. I need to run this command line at startup
echo 1 > /sys/module/bluetooth/parameters/disable_ertm
when I go to terminal type SU enter my password type that command it works perfectly, yet when i add that line the /etc/rc.local
echo 1 > /sys/module/bluetooth/parameters/disable_ertm before the exit 0 it does nothing at all....
New contributor
Steve is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
Im not sure what im missing but hoping for some help. I need to run this command line at startup
echo 1 > /sys/module/bluetooth/parameters/disable_ertm
when I go to terminal type SU enter my password type that command it works perfectly, yet when i add that line the /etc/rc.local
echo 1 > /sys/module/bluetooth/parameters/disable_ertm before the exit 0 it does nothing at all....
New contributor
Steve is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Im not sure what im missing but hoping for some help. I need to run this command line at startup
echo 1 > /sys/module/bluetooth/parameters/disable_ertm
when I go to terminal type SU enter my password type that command it works perfectly, yet when i add that line the /etc/rc.local
echo 1 > /sys/module/bluetooth/parameters/disable_ertm before the exit 0 it does nothing at all....
New contributor
Steve is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Steve is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
answered 28 mins ago
Steve
1
1
New contributor
Steve is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Steve is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Steve is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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%2f210939%2fwhat-user-runs-the-commands-defined-in-etc-rc-local%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