Why are user application configuration files saved in the user’s home directory and not under /etc with all the other system-wide configuration files?

Locating Configuration Files
a. Use the ls command to list all the files in the analyst home directory:


[analyst@secOps ~]$ ls –l
total 20
drwxr-xr-x 2 analyst analyst 4096 Sep 26 2014 Desktop
drwx------ 3 analyst analyst 4096 Jul 14 11:28 Downloads
drwxr-xr-x 8 analyst analyst 4096 Jul 25 16:27 lab.support.files
drwxr-xr-x 2 analyst analyst 4096 Mar 3 15:56 second_drive
-rw-r--r-- 1 analyst analyst 254 Aug 16 13:32 space.txt

While a few files are displayed, none of them seem to be configuration files. This is because it is convention to hide home-directory-hosted configuration files by preceding their names with a “.” (dot) character.
b. Use the ls command again but this time add the –a option to also include hidden files in the output:

[analyst@secOps ~]$ ls –la
total 268
drwxr-xr-x 19 analyst analyst 4096 Aug 2 15:43 .
drwxr-xr-x 3 root root 4096 Sep 26 2014 ..
-rw------- 1 analyst analyst 250 May 4 11:42 .atftp_history
-rw------- 1 analyst analyst 13191 Aug 1 09:48 .bash_history
-rw-r--r-- 1 analyst analyst 97 Mar 21 15:31 .bashrc
drwxr-xr-x 4 analyst analyst 4096 Jul 6 10:26 broken_down
drwxr-xr-x 10 analyst analyst 4096 Nov 7 2016 .cache
drwxr-xr-x 12 analyst analyst 4096 Jun 5 11:45 .config
-rw-r--r-- 1 analyst analyst 16384 Apr 12 10:06 .cyberops_topo.py.swp
drwxr-xr-x 2 analyst analyst 4096 Sep 26 2014 Desktop
-rw-r--r-- 1 analyst analyst 43 Sep 27 2014 .dmrc
drwx------ 3 analyst analyst 4096 Jul 14 11:28 Downloads
-rw-r--r-- 1 analyst analyst 72 Sep 26 2014 .fehbg
drwxr-xr-x 5 analyst analyst 4096 Sep 26 2014 .fluxbox
drwx------ 3 analyst analyst 4096 Sep 7 2016 .gnupg
-rw------- 1 analyst analyst 28920 Aug 2 15:01 .ICEauthority
drwxr-xr-x 2 analyst analyst 4096 Sep 26 2014 .idlerc
drwxr-xr-x 3 analyst analyst 4096 Sep 27 2014 .java
drwxr-xr-x 8 analyst analyst 4096 Jul 25 16:27 lab.support.files
-rw------- 1 analyst analyst 290 Jul 6 15:15 .lesshst
drwxr-xr-x 3 analyst analyst 4096 Sep 26 2014 .local


c. Use the cat command to display the contents of the .bashrc file. This file is used to configure user-specific terminal behavior and customization.

[analyst@secOps ~]$ cat .bashrc
export EDITOR=vim
PS1='\[\e[1;32m\][\u@\h \W]\$\[\e[0m\] '
alias ls="ls --color"
alias vi="vim"

Do not worry too much about the syntax of .bashrc at this point. The important thing to notice is that .bashrc contains configuration for the terminal. For example, the line PS1='\[\e[1;32m\][\u@\h \W]\$\[\e[0m\] ' defines the prompt structure of the prompt displayed by the terminal: [username@hostname current_dir] followed by a dollar sign, all in green. A few other configurations include shortcuts to commands such as ls and vi. In this case, every time the user types ls, the shell automatically converts that to ls –color to display a color-coded output for ls (directories in blue, regular files in grey,
executable files in green, etc.) The specific syntax is out of the scope of this course. What is important is understanding that user configurations are conventionally stored as hidden files in the user’s home directory.
d. While configuration files related to user applications are conventionally placed under the user’s home directory, configuration files relating to system-wide services are placed in the /etc directory, by convention. Web services, print services, ftp services, email services are examples of services that affect the entire system and of which configuration files are stored under /etc. Notice that regular users do not have writing access to /etc. This is important as it restricts the ability to change the system-wide service configuration to the root user only.
Use the ls command to list the contents of the /etc directory:

[analyst@secOps ~]$ ls /etc
adjtime host.conf mke2fs.conf rc_maps.cfg
apache-ant hostname mkinitcpio.conf request-key.conf
apparmor.d hosts mkinitcpio.d request-key.d
arch-release ifplugd modprobe.d resolv.conf
avahi initcpio modules-load.d resolvconf.conf
bash.bash_logout inputrc motd rpc
bash.bashrc iproute2 mtab rsyslog.conf
binfmt.d iptables nanorc securetty
ca-certificates issue netconfig security
crypttab java-7-openjdk netctl services
dbus-1 java-8-openjdk netsniff-ng shadow-
default kernel nginx shadowdepmod.
depmod.d krb5.conf nscd.conf shells
dhcpcd.conf ld.so.cache nsswitch.conf skel
dhcpcd.duid ld.so.conf ntp.conf ssh
dkms ld.so.conf.d openldap ssl
drirc libnl openvswitch sudoers
elasticsearch libpaper.d os-release sudoers.d
environment lightdm pacman.conf sudoers.pacnew
ethertypes locale.conf pacman.conf.pacnew sysctl.d
filebeat locale.gen pacman.d systemd
fonts locale.gen.pacnew pam.d tmpfiles.d
fstab localtime pango trusted-key.key
gai.conf login.defs papersize udev
gemrc logrotate.conf passwd UPower
group logrotate.d passwd- vdpau_wrapper.cfg
group- logstash pcmcia vimrc
group.pacnew lvm pkcs11 webapps
grub.d machine-id polkit-1 wgetrc
gshadow mail.rc profile X11
gshadow- makepkg.conf profile.d xdg
gshadow.pacnew man_db.conf protocols xinetd.d
gtk-2.0 mdadm.conf pulse yaourtrc
gtk-3.0 mime.types rc_keymaps

e. Use the cat command to display the contents of the bash_bashrc file:

[analyst@secOps ~]$ cat /etc/bash.bashrc
#
# /etc/bash.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
PS1='[\u@\h \W]\$ '
case ${TERM} in
xterm*|rxvt*|Eterm|aterm|kterm|gnome*)
PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf
"\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"'
;;
screen)
PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf
"\033_%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"'
;;
esac
[ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/
bash_completion
[analyst@secOps ~]$

The syntax of bash_bashrc is out of scope of this course. This file defines the default behavior of the shell for all users. If a user wants to customize his/her own shell behavior, the default behavior can be overridden by editing the .bashrc file located in the user’s home directory. Because this is a system-wide configuration, the configuration file is placed under /etc, making it editable only by the root user. Therefore, the user will have to log in as root to modify .bashrc.


Regular users do not have permission to write to /etc. Because Linux is a multi-user operating system, placing user-application configuration files under /etc would keep users from being able to customize their applications.

Computer Science & Information Technology

You might also like to view...

In Normal view, PowerPoint's ________ contains buttons such as Notes, Comments, and View

A) Ribbon B) status bar C) Quick Access Toolbar D) Outline pane

Computer Science & Information Technology

The ________ of a photo refers to the difference between the darkest and the lightest areas of the image

Fill in the blank(s) with correct word

Computer Science & Information Technology

An array of the names of four cities might be referred to as city0, city1, city2, and city3, or as city[0], city[1], city[2], and city[3].

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

________, conductive, and Faraday bags are especially important in the storage, analysis, and transportation of digital evidence

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology