What is the scope of environment variables defined in rc.local? [closed]
Ubuntu 14.04
Since rc.local is executed as root, does this mean that environment variables of rc.local will be available to all the processes run as root? Why?
Please include references while answering.
linux environment-variables
closed as unclear what you're asking by Christopher, jimmij, Rui F Ribeiro, X Tian, Archemar Feb 11 at 10:24
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
Ubuntu 14.04
Since rc.local is executed as root, does this mean that environment variables of rc.local will be available to all the processes run as root? Why?
Please include references while answering.
linux environment-variables
closed as unclear what you're asking by Christopher, jimmij, Rui F Ribeiro, X Tian, Archemar Feb 11 at 10:24
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
1
On what OS?rc.local
does very different things on Linux, FreeBSD, and OpenBSD. It probably does very different things on different Linux distributions.
– Satō Katsura
May 2 '17 at 7:32
@SatoKatsura edited
– Aquarius_Girl
May 2 '17 at 8:27
Doesn't Ubuntu 14.04 usesystemd
? Thenrc.local
is asystemd
-related thing. But even assuming SysV init, environment variables set in a shell script are inherited only by programs that are descendants of said script, and only if they areexport
-ed. The vast majority ofroot
processes you get to see are descendants oflogin
and / or some X display manager, which have nothing to do withrc.local
.
– Satō Katsura
May 2 '17 at 10:26
add a comment |
Ubuntu 14.04
Since rc.local is executed as root, does this mean that environment variables of rc.local will be available to all the processes run as root? Why?
Please include references while answering.
linux environment-variables
Ubuntu 14.04
Since rc.local is executed as root, does this mean that environment variables of rc.local will be available to all the processes run as root? Why?
Please include references while answering.
linux environment-variables
linux environment-variables
edited May 2 '17 at 8:27
Aquarius_Girl
asked May 2 '17 at 5:42
Aquarius_GirlAquarius_Girl
64042141
64042141
closed as unclear what you're asking by Christopher, jimmij, Rui F Ribeiro, X Tian, Archemar Feb 11 at 10:24
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
closed as unclear what you're asking by Christopher, jimmij, Rui F Ribeiro, X Tian, Archemar Feb 11 at 10:24
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
1
On what OS?rc.local
does very different things on Linux, FreeBSD, and OpenBSD. It probably does very different things on different Linux distributions.
– Satō Katsura
May 2 '17 at 7:32
@SatoKatsura edited
– Aquarius_Girl
May 2 '17 at 8:27
Doesn't Ubuntu 14.04 usesystemd
? Thenrc.local
is asystemd
-related thing. But even assuming SysV init, environment variables set in a shell script are inherited only by programs that are descendants of said script, and only if they areexport
-ed. The vast majority ofroot
processes you get to see are descendants oflogin
and / or some X display manager, which have nothing to do withrc.local
.
– Satō Katsura
May 2 '17 at 10:26
add a comment |
1
On what OS?rc.local
does very different things on Linux, FreeBSD, and OpenBSD. It probably does very different things on different Linux distributions.
– Satō Katsura
May 2 '17 at 7:32
@SatoKatsura edited
– Aquarius_Girl
May 2 '17 at 8:27
Doesn't Ubuntu 14.04 usesystemd
? Thenrc.local
is asystemd
-related thing. But even assuming SysV init, environment variables set in a shell script are inherited only by programs that are descendants of said script, and only if they areexport
-ed. The vast majority ofroot
processes you get to see are descendants oflogin
and / or some X display manager, which have nothing to do withrc.local
.
– Satō Katsura
May 2 '17 at 10:26
1
1
On what OS?
rc.local
does very different things on Linux, FreeBSD, and OpenBSD. It probably does very different things on different Linux distributions.– Satō Katsura
May 2 '17 at 7:32
On what OS?
rc.local
does very different things on Linux, FreeBSD, and OpenBSD. It probably does very different things on different Linux distributions.– Satō Katsura
May 2 '17 at 7:32
@SatoKatsura edited
– Aquarius_Girl
May 2 '17 at 8:27
@SatoKatsura edited
– Aquarius_Girl
May 2 '17 at 8:27
Doesn't Ubuntu 14.04 use
systemd
? Then rc.local
is a systemd
-related thing. But even assuming SysV init, environment variables set in a shell script are inherited only by programs that are descendants of said script, and only if they are export
-ed. The vast majority of root
processes you get to see are descendants of login
and / or some X display manager, which have nothing to do with rc.local
.– Satō Katsura
May 2 '17 at 10:26
Doesn't Ubuntu 14.04 use
systemd
? Then rc.local
is a systemd
-related thing. But even assuming SysV init, environment variables set in a shell script are inherited only by programs that are descendants of said script, and only if they are export
-ed. The vast majority of root
processes you get to see are descendants of login
and / or some X display manager, which have nothing to do with rc.local
.– Satō Katsura
May 2 '17 at 10:26
add a comment |
1 Answer
1
active
oldest
votes
No, the scripts in rc.local
are run as separate processes, which means they have no way to modify their parent's environment.
If you want to set environment variables system-wide, the place for that is /etc/profile
.
The FreeBSD rc.local
documentation mentions a convention that /etc/rc.d/
scripts whose name ends with .sh
will be sourced rather than executed independently. I don't think this is portable to other platforms, though I could be wrong.
please point out the manual where it is mentioned that the scripts in rc.local are run as separate processes.
– Aquarius_Girl
May 2 '17 at 5:55
I don't think it's explicitly mentioned (though "scripts" should suggest this interpretation; if the files were sourced by a shell, surely that would need to be mentioned!), but quick experimentation should easily bear this out. It's also not a heavily standardized mechanism, so the precise documentation depends on your platform. The FreeBSD manual page seems pretty exhaustive: freebsd.org/cgi/man.cgi?query=rc.local&sektion=8
– tripleee
May 2 '17 at 5:57
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
No, the scripts in rc.local
are run as separate processes, which means they have no way to modify their parent's environment.
If you want to set environment variables system-wide, the place for that is /etc/profile
.
The FreeBSD rc.local
documentation mentions a convention that /etc/rc.d/
scripts whose name ends with .sh
will be sourced rather than executed independently. I don't think this is portable to other platforms, though I could be wrong.
please point out the manual where it is mentioned that the scripts in rc.local are run as separate processes.
– Aquarius_Girl
May 2 '17 at 5:55
I don't think it's explicitly mentioned (though "scripts" should suggest this interpretation; if the files were sourced by a shell, surely that would need to be mentioned!), but quick experimentation should easily bear this out. It's also not a heavily standardized mechanism, so the precise documentation depends on your platform. The FreeBSD manual page seems pretty exhaustive: freebsd.org/cgi/man.cgi?query=rc.local&sektion=8
– tripleee
May 2 '17 at 5:57
add a comment |
No, the scripts in rc.local
are run as separate processes, which means they have no way to modify their parent's environment.
If you want to set environment variables system-wide, the place for that is /etc/profile
.
The FreeBSD rc.local
documentation mentions a convention that /etc/rc.d/
scripts whose name ends with .sh
will be sourced rather than executed independently. I don't think this is portable to other platforms, though I could be wrong.
please point out the manual where it is mentioned that the scripts in rc.local are run as separate processes.
– Aquarius_Girl
May 2 '17 at 5:55
I don't think it's explicitly mentioned (though "scripts" should suggest this interpretation; if the files were sourced by a shell, surely that would need to be mentioned!), but quick experimentation should easily bear this out. It's also not a heavily standardized mechanism, so the precise documentation depends on your platform. The FreeBSD manual page seems pretty exhaustive: freebsd.org/cgi/man.cgi?query=rc.local&sektion=8
– tripleee
May 2 '17 at 5:57
add a comment |
No, the scripts in rc.local
are run as separate processes, which means they have no way to modify their parent's environment.
If you want to set environment variables system-wide, the place for that is /etc/profile
.
The FreeBSD rc.local
documentation mentions a convention that /etc/rc.d/
scripts whose name ends with .sh
will be sourced rather than executed independently. I don't think this is portable to other platforms, though I could be wrong.
No, the scripts in rc.local
are run as separate processes, which means they have no way to modify their parent's environment.
If you want to set environment variables system-wide, the place for that is /etc/profile
.
The FreeBSD rc.local
documentation mentions a convention that /etc/rc.d/
scripts whose name ends with .sh
will be sourced rather than executed independently. I don't think this is portable to other platforms, though I could be wrong.
edited May 2 '17 at 6:00
answered May 2 '17 at 5:49
tripleeetripleee
5,23311829
5,23311829
please point out the manual where it is mentioned that the scripts in rc.local are run as separate processes.
– Aquarius_Girl
May 2 '17 at 5:55
I don't think it's explicitly mentioned (though "scripts" should suggest this interpretation; if the files were sourced by a shell, surely that would need to be mentioned!), but quick experimentation should easily bear this out. It's also not a heavily standardized mechanism, so the precise documentation depends on your platform. The FreeBSD manual page seems pretty exhaustive: freebsd.org/cgi/man.cgi?query=rc.local&sektion=8
– tripleee
May 2 '17 at 5:57
add a comment |
please point out the manual where it is mentioned that the scripts in rc.local are run as separate processes.
– Aquarius_Girl
May 2 '17 at 5:55
I don't think it's explicitly mentioned (though "scripts" should suggest this interpretation; if the files were sourced by a shell, surely that would need to be mentioned!), but quick experimentation should easily bear this out. It's also not a heavily standardized mechanism, so the precise documentation depends on your platform. The FreeBSD manual page seems pretty exhaustive: freebsd.org/cgi/man.cgi?query=rc.local&sektion=8
– tripleee
May 2 '17 at 5:57
please point out the manual where it is mentioned that the scripts in rc.local are run as separate processes.
– Aquarius_Girl
May 2 '17 at 5:55
please point out the manual where it is mentioned that the scripts in rc.local are run as separate processes.
– Aquarius_Girl
May 2 '17 at 5:55
I don't think it's explicitly mentioned (though "scripts" should suggest this interpretation; if the files were sourced by a shell, surely that would need to be mentioned!), but quick experimentation should easily bear this out. It's also not a heavily standardized mechanism, so the precise documentation depends on your platform. The FreeBSD manual page seems pretty exhaustive: freebsd.org/cgi/man.cgi?query=rc.local&sektion=8
– tripleee
May 2 '17 at 5:57
I don't think it's explicitly mentioned (though "scripts" should suggest this interpretation; if the files were sourced by a shell, surely that would need to be mentioned!), but quick experimentation should easily bear this out. It's also not a heavily standardized mechanism, so the precise documentation depends on your platform. The FreeBSD manual page seems pretty exhaustive: freebsd.org/cgi/man.cgi?query=rc.local&sektion=8
– tripleee
May 2 '17 at 5:57
add a comment |
1
On what OS?
rc.local
does very different things on Linux, FreeBSD, and OpenBSD. It probably does very different things on different Linux distributions.– Satō Katsura
May 2 '17 at 7:32
@SatoKatsura edited
– Aquarius_Girl
May 2 '17 at 8:27
Doesn't Ubuntu 14.04 use
systemd
? Thenrc.local
is asystemd
-related thing. But even assuming SysV init, environment variables set in a shell script are inherited only by programs that are descendants of said script, and only if they areexport
-ed. The vast majority ofroot
processes you get to see are descendants oflogin
and / or some X display manager, which have nothing to do withrc.local
.– Satō Katsura
May 2 '17 at 10:26