1
00:00:00,480 --> 00:00:01,530
In this lesson,

2
00:00:01,530 --> 00:00:04,110
we're going to learn how to configure the profile file

3
00:00:04,110 --> 00:00:06,900
in order to manage different account profiles.

4
00:00:06,900 --> 00:00:10,080
Now administrators have the task of managing various aspects

5
00:00:10,080 --> 00:00:12,450
of how different users can operate a system.

6
00:00:12,450 --> 00:00:14,850
This includes things like what software they can install,

7
00:00:14,850 --> 00:00:17,040
what they can update, what they can remove,

8
00:00:17,040 --> 00:00:18,360
which programs can run,

9
00:00:18,360 --> 00:00:19,740
the files they can read and write,

10
00:00:19,740 --> 00:00:21,540
and lots of other things.

11
00:00:21,540 --> 00:00:24,060
Typically, users have different personal habits

12
00:00:24,060 --> 00:00:26,100
that'll help them increase their productivity,

13
00:00:26,100 --> 00:00:28,020
so you want to be able to allow them

14
00:00:28,020 --> 00:00:30,690
to customize their profile for an optimal experience

15
00:00:30,690 --> 00:00:34,110
within their Linux environment according to their own needs.

16
00:00:34,110 --> 00:00:35,880
Now there are many files and directories

17
00:00:35,880 --> 00:00:37,950
from which you can create a standard profile

18
00:00:37,950 --> 00:00:39,150
for account users.

19
00:00:39,150 --> 00:00:41,790
And we're going to take a look at some of those in this lesson.

20
00:00:41,790 --> 00:00:44,940
Now the first one is the .bashrc file.

21
00:00:44,940 --> 00:00:48,300
This enables customization of the user's own environment.

22
00:00:48,300 --> 00:00:50,310
This file is unique to each user,

23
00:00:50,310 --> 00:00:51,210
so it can be configured

24
00:00:51,210 --> 00:00:54,270
to a user's own specific needs or preferences.

25
00:00:54,270 --> 00:00:55,470
A great example of the use

26
00:00:55,470 --> 00:00:59,100
of a .bashrc file is the use of aliases.

27
00:00:59,100 --> 00:01:01,530
Users can specify their own abbreviated commands

28
00:01:01,530 --> 00:01:03,600
without impacting the experience of anybody else

29
00:01:03,600 --> 00:01:05,700
who might log into that system.

30
00:01:05,700 --> 00:01:06,990
Another common configuration

31
00:01:06,990 --> 00:01:09,450
within the bashrc file is the creation

32
00:01:09,450 --> 00:01:11,160
of an environment variable.

33
00:01:11,160 --> 00:01:13,710
Now the bashrc file can also be configured

34
00:01:13,710 --> 00:01:16,830
to set default directories and file permissions for the user

35
00:01:16,830 --> 00:01:19,020
and to change the default command prompt

36
00:01:19,020 --> 00:01:21,540
to provide different information to the user.

37
00:01:21,540 --> 00:01:25,320
The next one we have is the .bash_profile file.

38
00:01:25,320 --> 00:01:27,930
And this is going to be used to provide the shell configuration

39
00:01:27,930 --> 00:01:29,880
for the initial login environment.

40
00:01:29,880 --> 00:01:32,820
Now this differs from the .bashrc file

41
00:01:32,820 --> 00:01:33,840
because it provides settings

42
00:01:33,840 --> 00:01:36,000
for all of the user's interactive shells,

43
00:01:36,000 --> 00:01:37,590
not just one user.

44
00:01:37,590 --> 00:01:40,980
So when you change the .bash_profile file,

45
00:01:40,980 --> 00:01:43,350
it's going to be read with the first login.

46
00:01:43,350 --> 00:01:45,390
Now after that, we're going to move over

47
00:01:45,390 --> 00:01:47,970
and start using the .bashrc file.

48
00:01:47,970 --> 00:01:51,840
So whatever you change in the .bash_profile file,

49
00:01:51,840 --> 00:01:54,180
think about that as part of the skeleton file

50
00:01:54,180 --> 00:01:55,620
when you create a new account.

51
00:01:55,620 --> 00:01:58,290
That's going to get added to that new account as well.

52
00:01:58,290 --> 00:02:00,270
An administrator might find it desirable

53
00:02:00,270 --> 00:02:02,160
to define some system-wide settings

54
00:02:02,160 --> 00:02:05,220
or to configure the initial settings for all the users.

55
00:02:05,220 --> 00:02:09,960
And this is a case where .bash_profile is great to use.

56
00:02:09,960 --> 00:02:11,550
There are several files and directories

57
00:02:11,550 --> 00:02:13,680
that enable the administrator to have flexibility

58
00:02:13,680 --> 00:02:15,510
to make a variety of configurations.

59
00:02:15,510 --> 00:02:17,910
And each of these can be customized by the user

60
00:02:17,910 --> 00:02:20,010
for their own needs as well later on.

61
00:02:20,010 --> 00:02:21,360
Again, this all starts out

62
00:02:21,360 --> 00:02:24,900
with that first file, .bash_profile.

63
00:02:24,900 --> 00:02:26,850
Now, when a new user account is created,

64
00:02:26,850 --> 00:02:30,000
the contents of the /etc/skel directory

65
00:02:30,000 --> 00:02:31,560
or the skeleton directory,

66
00:02:31,560 --> 00:02:32,970
are going to be automatically copied

67
00:02:32,970 --> 00:02:35,130
into the new user's home directory.

68
00:02:35,130 --> 00:02:36,960
When the user ADD command is run,

69
00:02:36,960 --> 00:02:39,870
the etc/skel directory is going to be copied

70
00:02:39,870 --> 00:02:41,790
into that new user's home directory,

71
00:02:41,790 --> 00:02:44,310
immediately giving them a baseline configuration

72
00:02:44,310 --> 00:02:46,260
that you have set as the administrator.

73
00:02:46,260 --> 00:02:50,460
Note, any files added to that /etc/skel directory

74
00:02:50,460 --> 00:02:53,160
after a new user account is created will not be copied

75
00:02:53,160 --> 00:02:55,710
to the home directories of existing users,

76
00:02:55,710 --> 00:02:57,900
only to new users moving forward.

77
00:02:57,900 --> 00:03:00,030
Because once that copy is made for a user,

78
00:03:00,030 --> 00:03:01,770
that becomes part of their profile

79
00:03:01,770 --> 00:03:03,480
and they get to customize it.

80
00:03:03,480 --> 00:03:06,870
You no longer are customizing it as a system administrator.

81
00:03:06,870 --> 00:03:09,090
Now there's going to be instances when an administrator

82
00:03:09,090 --> 00:03:11,400
also wants to apply certain settings to accounts

83
00:03:11,400 --> 00:03:13,650
for all the users on a system.

84
00:03:13,650 --> 00:03:18,360
When this happens, you should use /etc/profile.

85
00:03:18,360 --> 00:03:19,830
This file is going to be useful

86
00:03:19,830 --> 00:03:22,590
because it provides system-wide environmental variables

87
00:03:22,590 --> 00:03:24,570
that can be used for this purpose.

88
00:03:24,570 --> 00:03:27,270
Now, during the initial log in process for a user,

89
00:03:27,270 --> 00:03:31,770
the system actually reads the /etc/profile file first,

90
00:03:31,770 --> 00:03:34,380
and it does this for your Bash shell configurations.

91
00:03:34,380 --> 00:03:37,890
Then it goes to any user's specific Bash customizations

92
00:03:37,890 --> 00:03:40,560
that it's going to pull from the .profile file

93
00:03:40,560 --> 00:03:43,230
that's located inside the user's home directory.

94
00:03:43,230 --> 00:03:46,860
The .profile file will run each time a new shell is started,

95
00:03:46,860 --> 00:03:51,450
whereas the /etc/profile file is only run at login.

96
00:03:51,450 --> 00:03:53,100
This approach enables administrators

97
00:03:53,100 --> 00:03:55,050
to define global shell settings,

98
00:03:55,050 --> 00:03:57,990
but it still allows user's specific customizations

99
00:03:57,990 --> 00:03:59,910
to happen on the system.

100
00:03:59,910 --> 00:04:03,710
Another thing we need to talk about is /etc/profile.d.

101
00:04:04,680 --> 00:04:07,350
This is a directory that serves as a storage location

102
00:04:07,350 --> 00:04:09,480
for scripts that administrators may use

103
00:04:09,480 --> 00:04:12,000
to set additional system-wide variables.

104
00:04:12,000 --> 00:04:13,920
All the configurations that you want to apply

105
00:04:13,920 --> 00:04:16,320
to your system user's environments should be added

106
00:04:16,320 --> 00:04:18,240
inside of this directory.

107
00:04:18,240 --> 00:04:20,820
It's recommended that you set the environmental variables

108
00:04:20,820 --> 00:04:24,630
via scripts contained in the /etc/profile.d

109
00:04:24,630 --> 00:04:28,770
rather than editing the /etc/profile file directly.

110
00:04:28,770 --> 00:04:30,210
This gives you better control,

111
00:04:30,210 --> 00:04:33,270
and it is a safer and more secure way of doing things.

112
00:04:33,270 --> 00:04:34,260
Now the final thing we need

113
00:04:34,260 --> 00:04:38,070
to talk about is /etc/bashrc again.

114
00:04:38,070 --> 00:04:41,010
This file provides system-wide Bash settings.

115
00:04:41,010 --> 00:04:41,970
This is a little different

116
00:04:41,970 --> 00:04:44,880
than the /etc/profile we just talked about

117
00:04:44,880 --> 00:04:48,360
because /etc/profile is used for variables.

118
00:04:48,360 --> 00:04:51,660
But when you're using the /etc/bashrc,

119
00:04:51,660 --> 00:04:53,130
it follows the same principles

120
00:04:53,130 --> 00:04:55,560
of making these system-wide configuration changes,

121
00:04:55,560 --> 00:04:57,870
but it's applying specifically to the Bash settings

122
00:04:57,870 --> 00:04:59,570
for your command line environment.

