In this lesson,
we're going to learn how to configure the profile file
in order to manage different account profiles.
Now administrators have the task of managing various aspects
of how different users can operate a system.
This includes things like what software they can install,
what they can update, what they can remove,
which programs can run,
the files they can read and write,
and lots of other things.
Typically, users have different personal habits
that'll help them increase their productivity,
so you want to be able to allow them
to customize their profile for an optimal experience
within their Linux environment according to their own needs.
Now there are many files and directories
from which you can create a standard profile
for account users.
And we're going to take a look at some of those in this lesson.
Now the first one is the .bashrc file.
This enables customization of the user's own environment.
This file is unique to each user,
so it can be configured
to a user's own specific needs or preferences.
A great example of the use
of a .bashrc file is the use of aliases.
Users can specify their own abbreviated commands
without impacting the experience of anybody else
who might log into that system.
Another common configuration
within the bashrc file is the creation
of an environment variable.
Now the bashrc file can also be configured
to set default directories and file permissions for the user
and to change the default command prompt
to provide different information to the user.
The next one we have is the .bash_profile file.
And this is going to be used to provide the shell configuration
for the initial login environment.
Now this differs from the .bashrc file
because it provides settings
for all of the user's interactive shells,
not just one user.
So when you change the .bash_profile file,
it's going to be read with the first login.
Now after that, we're going to move over
and start using the .bashrc file.
So whatever you change in the .bash_profile file,
think about that as part of the skeleton file
when you create a new account.
That's going to get added to that new account as well.
An administrator might find it desirable
to define some system-wide settings
or to configure the initial settings for all the users.
And this is a case where .bash_profile is great to use.
There are several files and directories
that enable the administrator to have flexibility
to make a variety of configurations.
And each of these can be customized by the user
for their own needs as well later on.
Again, this all starts out
with that first file, .bash_profile.
Now, when a new user account is created,
the contents of the /etc/skel directory
or the skeleton directory,
are going to be automatically copied
into the new user's home directory.
When the user ADD command is run,
the etc/skel directory is going to be copied
into that new user's home directory,
immediately giving them a baseline configuration
that you have set as the administrator.
Note, any files added to that /etc/skel directory
after a new user account is created will not be copied
to the home directories of existing users,
only to new users moving forward.
Because once that copy is made for a user,
that becomes part of their profile
and they get to customize it.
You no longer are customizing it as a system administrator.
Now there's going to be instances when an administrator
also wants to apply certain settings to accounts
for all the users on a system.
When this happens, you should use /etc/profile.
This file is going to be useful
because it provides system-wide environmental variables
that can be used for this purpose.
Now, during the initial log in process for a user,
the system actually reads the /etc/profile file first,
and it does this for your Bash shell configurations.
Then it goes to any user's specific Bash customizations
that it's going to pull from the .profile file
that's located inside the user's home directory.
The .profile file will run each time a new shell is started,
whereas the /etc/profile file is only run at login.
This approach enables administrators
to define global shell settings,
but it still allows user's specific customizations
to happen on the system.
Another thing we need to talk about is /etc/profile.d.
This is a directory that serves as a storage location
for scripts that administrators may use
to set additional system-wide variables.
All the configurations that you want to apply
to your system user's environments should be added
inside of this directory.
It's recommended that you set the environmental variables
via scripts contained in the /etc/profile.d
rather than editing the /etc/profile file directly.
This gives you better control,
and it is a safer and more secure way of doing things.
Now the final thing we need
to talk about is /etc/bashrc again.
This file provides system-wide Bash settings.
This is a little different
than the /etc/profile we just talked about
because /etc/profile is used for variables.
But when you're using the /etc/bashrc,
it follows the same principles
of making these system-wide configuration changes,
but it's applying specifically to the Bash settings
for your command line environment.