Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Aug 2009
    Midwestern US

    does /etc/bashrc get executed

    Basically, add them to ~/.bashrc, and they take effect whenever you login as that user.

    To make systemwide changes, do the same thing, but to the /etc/profile file.

    So does /etc/bashrc get executed if a system reboots and no one has logged in yet? i.e. if one has a web server on a VPS that may get rebooted from time to time, is it then the /etc/profile that one set required environment variables from?

  2. #2
    Linux Guru Cabhan's Avatar
    Join Date
    Jan 2005
    Seattle, WA, USA
    /etc/bashrc and ~/.bashrc are configuration files for Bash. They will be sourced by a particular user whenever that user creates a new bash session.

    In your example of a webserver, assuming the server is run automatically, or by a user who has no shell, the bashrc is the wrong place to set such variables. To set environment variables for the webserver, you would either need to go through the web server's configuration files, or write a shell script that sets up the environment and then executes the web server.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts