Wikia

How To Wiki

Guide to linux configuration files

Talk0
1,864pages on
this wiki

This guide will show where various linux configuration files are located, shows howto configure them.


In many cases are global config files, and local config files.

  • Global config files
    • Apply to all users
    • Usually located in /etc
  • Local config files
    • Applies to a specific user
    • Stored in the users home dir, as ~/.example or ~/.config/example
    • AKA dot files

Locations of config files change name and location over time and different Linux Distributions, so the files listed here may not match your Linux installation, but the are generally close.

For example
  • bashrc may be located in /etc/bash/bashrc or /etc/bashrc
  • kdmrc may be located in /usr/share/config/kdm/kdmrc, /usr/local/share/config/kdm/kdmrc, or /opt/kde/share/config/kdm/kdmrc


/etc - the basicsEdit

  • /etc/DIR_COLORS - colors use by the "ls" command
  • /etc/X11/ - config files for X-Windows
  • /etc/adjtime - correction factor for the RTC (do not edit)
  • /etc/bash/ - config files for bash
  • /etc/conf.d/ - config dir for Gentoo and other Distributions
  • /etc/cron.d/
  • /etc/cron.daily/ - scripts within are run daily by cron
  • /etc/cron.deny - list of users for which cron is denyed
  • /etc/cron.allow - list of users for which cron is allowed
  • /etc/cron.hourly/ - scripts within are run hourly by cron
  • /etc/cron.monthly/ - scripts within are run monthly by cron
  • /etc/cron.weekly/ - scripts within are run weekly by cron
  • /etc/crontab - general config for cron
  • /etc/cups/ - config dir for CUPS printer server
  • /etc/dbus-1/ - dir for dbus config files
  • /etc/default/ - dir for dbus config files like adduser
  • /etc/dhcpcd.conf
  • /etc/dispatch-conf.conf
  • /etc/e2fsck.conf - config for fschk for ext2 and ext3 filesystems
  • /etc/env.d/ - dir for environment variables in Gentoo and other distributions
  • /etc/environment - environment variables [1]
  • /etc/exports - file systems are exported to remote hosts [2]
  • /etc/filesystems - defines the filesystems search order used by mount -t auto
  • /etc/fonts/ - config dir for fontconfig
  • /etc/fstab - mount points
  • /etc/gconf/ - dir for Gnome based applications [3]
  • /etc/gpm/ - console mouse
  • /etc/group - groups and the users within them
  • /etc/group- - (do not edit)
  • /etc/gshadow - Secure group account information
  • /etc/gshadow- - (do not edit)
  • /etc/host.conf - specifies how host names on a network are resolved [4]
  • /etc/hosts - associates IP addresses with hostnames
  • /etc/init.d/ or /etc/rc.d/init.d/ - dir for init scripts
  • /etc/inittab - describes which processes are started at bootup [5]
  • /etc/inputrc - keyboard mapping for bash and most other shells
  • /etc/issue - message displayed before console or ssh logins [6]
  • /etc/kernel/ - dir for scripts such as post-installation of the Linux kernel
  • /etc/ld.so.cache - (do not edit)
  • /etc/ld.so.conf - library path
  • /etc/ld.so.conf.d/ - dir for config files that include library paths
  • /etc/local.d/ - scripts run by "local" init script
  • /etc/locale.gen - lists the locales used
  • /etc/localtime - symbolic link to a timezone file
  • /etc/login.defs - config for the shadow package [7]
  • /etc/machine-id - unique machine id set during installation [8]
  • /etc/mail/ - dir of config files for mail system
  • /etc/mailcap - describs how mime-types should be displayed [9]
  • /etc/make.conf
  • /etc/man.conf - config for man
  • /etc/mime.types - (do not edit)
  • /etc/mke2fs.conf
  • /etc/modprobe.d/
  • /etc/mtab (do not edit)
  • /etc/netconfig
  • /etc/networks
  • /etc/nscd.conf
  • /etc/nsswitch.conf
  • /etc/pam.d/
  • /etc/papersize
  • /etc/passwd
  • /etc/passwd- (do not edit)
  • /etc/profile
  • /etc/profile.d/
  • /etc/profile.env
  • /etc/protocols - list of network protocols (do not edit) [10]
  • /etc/rc.conf
  • /etc/resolv.conf
  • /etc/rpc - RPC program number database (do not edit)
  • /etc/runlevels/
  • /etc/securetty
  • /etc/security/
  • /etc/services
  • /etc/shadow - (do not edit)
  • /etc/shadow- - (do not edit)
  • /etc/shells
  • /etc/skel/
  • /etc/sound/
  • /etc/ssh/
  • /etc/ssl/
  • /etc/sudoers - config for sudo
  • /etc/sudoers.d/
  • /etc/sysctl.conf
  • /etc/sysstat
  • /etc/sysstat.ioconf
  • /etc/terminfo/
  • /etc/timezone
  • /etc/udev/
  • /etc/unixODBC/
  • /etc/updatedb.conf
  • /etc/xdg/
  • /etc/xinetd.d/

Users and GroupsEdit

Users: /etc/passwdEdit

/etc/passwd is the user authentication database, it contains a list of users and their associated internal user id numbers. Historically it also included passwords, however as this file needs to world readable (so all programs can use it to convert between username and user id) it is no longer considered secure to keep passwords in this file.

An entry in this file is of the form:

alice:*:134:20:Alice Monkey:/home/alice/:/bin/bash

It has seven sections which going from left to right are,

  • (alice) The username.
  • (*) The password in a hashed form. In modern systems a star indicates shadowing is in use and hence the password can be found in /etc/shadow/.
  • (134) The unique id assigned to the user. Some unique ids have special purposes. For example the user id 0 is used for the root user.
  • (20) The group that the user is assigned to upon login.
  • (Alice Monkey) The GCOS field, can be used for anything or left blank. Normally used for personal information abou the user such as full name.
  • (/home/alice/) The home directory of the user.
  • (/bin/bash) The users default shell.

Groups: /etc/groupEdit

/etc/group stores the definitive list of the users groups and their members.

A typical entry is:

root::0:root,alice

It has four sections which going from left to right are,

  • (root) The group name.
  • () The group password in a hashed form. Normally not used.
  • (0) The unique id assigned to the group. Group ids below 10 are reserved for system use. Some unixs such as HP-UX reserve other groups numbers as well.
  • (root,alice) The list of users who are members of that group.

     

Boot Up SettingsEdit

  • Boot file sequence in the order they are accessed or executed
    1. boot loader (grub/lilo)
    2. linux kernel
    3. /etc/inittab
    4. /etc/rc.sysinit
      1. init scripts
    5. Login or X windows
  • /etc/inittab - runs different programs and processes on startup. This is typically the program which is responsible for, among other things, setting the default runlevel, running the rc.sysinit script contained in /etc/rc.d, setting up virtual login terminals, bringing down the system in an orderly fashion in response to [Ctrl][Alt][Del], running the rc script in /etc/rc.d, and running xdm for a graphical login prompt (only if the default runlevel is set for a graphical login).


See: Guide to linux boot sequence  

LILOEdit

GrubEdit

  • Grub (legacy)
    • /boot/grub/grub.conf
  • Grub2
    • /boot/grub/grub.cfg - Menu information
    • /etc/default/grub - Basic configs
    • /etc/grub.d/ - scripts in this directory are read during execution of the update-grub command and their instructions are incorporated into /boot/grub/grub.cfg.

       

Package ManagersEdit

emergeEdit

  • /etc/make.conf
  • /etc/make.profile
  • /etc/portage/package.keywords
  • /etc/portage/package.use
  • /etc/portage/package.mask
  • /etc/portage/package.unmask
  • /etc/portage/package.accept_keywords
  • /etc/portage/rsync_excludes
  • /etc/portage/package.env
  • /etc/portage/env/debug-cflags
  • /etc/portage/postsync.d/

Optional:

  • /etc/dispatch-conf.conf - dispatch-conf

References: [12]  

PaludisEdit

  • /etc/paludis/general.conf
  • /etc/paludis/keywords.conf (Gentoo) or /etc/paludis/platforms.conf (Exherbo)
  • /etc/paludis/use.conf (Gentoo) or /etc/paludis/options.conf (Exherbo)
  • /etc/paludis/licenses.conf (Gentoo) or /etc/paludis/licences.conf (Exherbo)
  • /etc/paludis/bashrc
  • /etc/paludis/repositories/gentoo.conf (Gentoo)
  • /etc/paludis/repositories/installed.conf
  • /etc/paludis/repositories/paludis-overlay.conf
  • /etc/paludis/repositories/layman.conf
  • /etc/paludis/repositories/repository.conf
  • /etc/paludis/repositories/arbor.conf (Exherbo)
  • /etc/paludis/repositories/unavailable.conf (Exherbo)
Reference : [13]

pacmanEdit

/etc/pacman.conf /etc/pacman.d/mirrorlist  

aptEdit

  • /etc/apt/apt.conf
  • /etc/apt/apt.conf.d/
    Reference : [14]
  • /etc/apt/sources.list
  • /etc/apt/sources.list.d/
    Reference : [15]
  • /etc/apt/vendors.list
    Reference : [16]
  • ~/.aptitude/config

yumEdit

  • /etc/yum.conf
  • /etc/yum.repos.d/
  • /etc/yum/pluginconf.d/
  • /etc/yum/protected.d
  • /etc/yum/vars
    Reference : [17]
  • /etc/yum/yum-updatesd.conf
    Reference : [18]

rpmEdit

  • /usr/lib/rpm/rpmrc
  • /usr/lib/rpm/redhat/rpmrc
  • /etc/rpmrc
  • ~/.rpmrc
  • /usr/lib/rpm/macros
  • /usr/lib/rpm/redhat/macros
  • /etc/rpm/macros
  • ~/.rpmmacros
Reference : [19]
  • /etc/sysconfig/rhn/sources


dpkgEdit

  • /etc/dpkg/dpkg.cfg
Reference : [20]


opkgEdit

  • /etc/opkg.conf
Reference : [21]

Smart Package ManagerEdit

/etc/smart/        

LibrariesEdit

  • Library Path
    • /etc/ld.so.conf
      after editing, execute '/sbin/ldconfig' to refresh the library cache

   

Environment VariablesEdit

     

NetworkingEdit

  • /etc/hosts - contains a list of host names and absolute IP addresses.
  • /etc/hosts.allow - hosts allowed (by the tcpd daemon) to access Internet services
  • /etc/hosts.deny - hosts forbidden (by the tcpd daemon) to access Internet services
  • /etc/resolv.conf - contains a list of domain name servers used by the local machine
  • /etc/hostname - stores the name of the host computer

Howto setup a network in linux  

ServersEdit

Config file for various Linux daemons. Included is Apache, Lighttpd, OpenSSHD, Samba, ProFTPd, MySQL, PostgreSQL, OpenNTPD, vsftpd, WU-FTPd, DNS BIND, NSD pdnsd

See: Guide to linux configuration files/Servers        

SystemEdit

Setting System/Hardware ClockEdit

  • Symbolic link to timezone
    • /etc/localtime
  • UTC or local time zone

Hard/USB/floppy/CDROM/Network Drive MountsEdit

  • /etc/fstab - Links devices to mount points

LocaleEdit

  • /etc/locale.gen
  • ~/.dmrc - Gnome language encoding config
    Reference: [22]

locate/slocate/mlocateEdit

  • /etc/updatedb.conf

sudoEdit

  • /etc/sudoers

KernelEdit

  • /usr/src/linux/.config - the kernel's config file that is used to compile

Kernel ModulesEdit

  • /etc/modules.conf
  • /etc/modprobe.conf or /etc/modprobe.d/modprobe.conf

CronEdit

  • /etc/crontab - shell script to run different commands periodically (hourly, daily, weekly, monthly, etc.)
  • /etc/cron.deny - deny user the ability run crontab
  • /etc/cron.d/
  • /etc/cron.hourly/
  • /etc/cron.daily/
  • /etc/cron.weekly/
  • /etc/cron.monthly/

mdadm (RAID)Edit

  • /etc/mdadm/mdadm.conf or /etc/mdadm.conf
References: [23]


mkinitcpio (RAM disk init)Edit

/etc/mkinitcpio.conf /etc/mkinitcpio.d/linux.preset

References: [24]

syslogEdit

  • syslogd
    • /etc/syslog.conf
      References: [25]
  • syslog-ng
    • /etc/syslog-ng/syslog-ng.conf
      References: [26]

ALSAEdit

  • /etc/asound.conf
  • ~/.asoundrc
    References: [27]

DBUSEdit

  • /etc/dbus-1/system.conf
  • /etc/dbus-1/system.d/
  • /etc/dbus-1/session.conf
  • /etc/dbus-1/session.d/
    References: [28]

udevEdit

  • /etc/udev/* - udev config files
  • /etc/dev.d/* - programs invoked by udev
    References: [29]

logrotateEdit

  • /etc/logrotate.conf
  • /etc/logrotate.d/
    References: [30]

ATEdit

  • /etc/at.deny
  • /etc/at.allow
    References: [31]

PAMEdit

  • /etc/pam.conf - the configuration file
  • /etc/pam.d - the Linux-PAM configuration directory. Generally, if this directory is present, the /etc/pam.conf file is ignored.
    References: [32]


ApplicationsEdit

See: Guide to linux configuration files/Applications            

ShellsEdit

  • /etc/DIR_COLORS - used to store colors for different file types when using ls command. The dircolors command uses this file when there is not a .dir_colors file in the user's home directory. Used in conjunction with the eval command (see below).
  • /etc/motd - message of the day file, printed immediately after login. This is often overwritten by /etc/rc.d/rc.S (Slackware) or /etc/rc.d/rc.local (Mandrake/Red Hat) on startup. See the remarks in connection with /etc/issue.
  • /etc/issue - pre-login message. This is often overwitten by the /etc/rc.d/rc.S script (in Slackware) or by the /etc/rc.d/rc.local script (in Mandrake and Red Hat, and perhaps other rpm-based distributions). The relevant lines should be commented out (or changed) in these scripts if a custom pre-login message is desired.

bashEdit

  • /etc/bashrc
  • /etc/profile
  • /etc/bashrc
  • /etc/bash/bashrc
  • /etc/bash/bash_profile
  • /etc/bash/bash_login
  • /etc/bash/bash_logout
  • ~/.profile
  • /etc/profile contains the system default settings for users who login using the Bourne shell, "/bin/sh". When these users login, the Bourne shell runs the commands in this file before giving the shell prompt to the user. Most of these commands are variable assignments which configure the behavior of the shell.
  • ~/.bash_logout - file executed by bash shell on logout
  • ~/.bash_profile - initialization of bash shell run only on login. Bash looks first for a .bash_profile file when started as a login shell or with the -login option. If it does not find .bash_profile, it looks for .bash_login. If it doesn't find that, it looks for .profile. System-wide functions and aliases go in /etc/bashrc and default environment variables go in /etc/profile.
  • ~/.bashrc - initialization command run when bash shell starts up as a non-login shell
  • /etc/inputrc
Examples: http://dotfiles.org/.bash_profile
Examples: http://dotfiles.org/.bashrc

cshEdit

  • profile.csh
  • csh.login
  • csh.envc
  • sh.cshrc
  • /etc/cshrc
  • ~/.login
  • ~/.cshrc
  • ~/.logout

zshell (zsh)Edit

  • Order they are loaded: /etc/zshenv then ~/.zshenv, if login shell /etc/zprofile then ~/.zprofile, if interactive shell /etc/zshrc then ~/.zshrc, If login shell, /etc/zlogin and ~/.zlogin
  • /etc/profile contains the system default settings for users who login using the Bourne shell, "/bin/sh". When these users login, the Bourne shell runs the commands in this file before giving the shell prompt to the user. Most of these commands are variable assignments which configure the behavior of the shell.
Examples: http://dotfiles.org/.zshrc
Examples: http://dotfiles.org/.zlogin


tcshEdit

  • ~/.login
  • ~/.tcshrc
  • ~/.logout

kshEdit

  • ~/.kshrc
  • /etc/profile
  • ~/.profile

shEdit

  • /etc/profile
  • ~/.profile


X WindowsEdit

  1. Starting X Windows
    1. /etc/X11/XF86Config for XFree86, /etc/X11/xorg.conf for X.Org
    2. many different scripts depending on install
    3. ~/.xinitrc
      • Executed whenb running startx, should contain your window managers executable
    4. ~/.Xdefaults


Look and Feel (User Interface)Edit

Not all Windows managers follow these config files but many do.

  • Default application for a mimetype (XGD spec)
    • /usr/share/applications/defaults.list
  • ~/.local/share/applications/mimeapps.list
  • Application launcher, for menus and default apps
    • /usr/share/applications/*.desktop
    • ~/.local/share/applications/*.desktop
  • GTK based applications
    • /etc/gtk-2.0/gtkrc
    • ~/.gtkrc-2.0
    • ~/.gtkrc-2.0.mine - used when .gtkrc-2.0 is auto-generated, sourced from .gtkrc-2.0
    • ~/.config/gtk-2.0/gtkfilechooser.ini - options for file open/save chooser
    • /etc/gtk-3.0/settings.ini
Examples: http://dotfiles.org/.gtkrc-2.0

Display ManagersEdit

XDMEdit

X-Windows default Display Manager

  • /etc/X11/xdm
  • /usr/X11R6/lib/X11/xdm - SuSE 6.4
  • /etc/X11/Xaccess - Client authorization ruleset.
  • /etc/X11/Xresources - Default X resource values.
  • /etc/X11/Xservers - List of remote and local displays to manage.
  • /etc/X11/Xsession - Default session script for logins.
  • /etc/X11/Xsetup_* - Script to launch applications before the login interface.
  • /etc/X11/xdm-config - Global configuration for all displays running on this machine.
  • /etc/X11/xdm-errors - Errors generated by the server program.
  • /etc/X11/xdm-pid - The process ID of the currently running XDM.
Depeding on your distribution /etc may be replaced by /usr/lib or /usr/local/lib

GDMEdit

Gnome Display Manager

  • /etc/gdm/gdm.conf

KDMEdit

KDE Display Manager

  • /usr/share/config/kdm/kdmrc

SLiMEdit

/etc/slim.conf

Window ManagersEdit

Here are a very long list of config for many Window managers. Included are AfterStep, Awsome, Catwm, Enlightenment, Fluxbox, Fvwm95, Gnome, Herbstluftwm, IceWM, Ion, JWM, KDE, Matchbox, Mosterwm, Motif Window Manager, Musca, OpenBox, OpenLook Virtual Window Manager, OpenLook Window Manager, PMWM, Pawm, PekWM, QVWM, Sawfish, Snapwm, Tab Virtual Window Manager, Tab Window Manager (TWM), WMFS, Window Maker, XFCE, Xmonad, echinus, evilwm, fvwm2, fvwm, i3, ratpoison, spectrwm, subtle, wmii, and more

See: Guide to linux configuration files/Window Managers    

Distribution SpecificEdit

RedhatEdit

  • Main Config files dir
    • /etc/sysconfig/
  • Redhat 8-9
  • Login Manager, add window manager
    • /etc/X11/xdm/Xsession
    • /usr/share/apps/switchdesk/Xclients.wmaker
    • /etc/X11/gdm/Sessions/wmaker

SuseEdit

  • Main Config files dir
    • /etc/sysconfig/

FedoraEdit

  • Main Config files dir
    • /etc/sysconfig/
References: Fedora 12 - Chapter 17. The sysconfig Directory


GentooEdit

  • Main Config files dir
    • /etc/conf.d/
    • /etc/env.d/
  • Portage
    • /etc/portage/package.keywords
    • /etc/portage/package.unmask
    • /etc/portage/profile/package.provided
  • Compileing
    • /etc/make.conf
    • /etc/make.profile/make.defaults
    • /etc/make.profile/packages
    • /etc/make.profile/parent
  • /etc/profile.env
  • /etc/env.d/*
    • /etc/env.d/10ldpath
    • /etc/env.d/05gcc
    • /etc/env.d/01hostname
    • /etc/env.d/00basic
  • /etc/conf.d/*
    • /etc/conf.d/local.stop
    • /etc/conf.d/local.start


Files to be merged in to the listEdit

  • /etc/aliases - file containing aliases used by sendmail and other MTAs (mail transport agents). After updating this file, it is necessary to run the newaliases utility for the changes to be passed to sendmail.
  • /etc/conf.modules - aliases and options for configurable modules
  • /etc/exports - specifies hosts to which file systems can be exported using NFS. Man exports contains information on how to set up this file for remote users.
  • /etc/inetd.conf - configures the inetd daemon to tell it what TCP/IP services to provide (which daemons to load at boot time). A good start to securing a Linux box is to turn off these services unless they are necessary.
  • ~/.login - initialization file when user logs in
  • ~/.logout - commands run when user logs out
  • ~/.wm_style - gives choice of default window manager if one is not specified in startx
  • ~/.xsession - configuration file for xdm

/etc/sysctl.conf configures the behavior of the running Unix kernel. During system boot, the scripts read this file and use "sysctl" to set the parameters shown in the file. Changing the file has no effect before the next reboot.

  • ~/.htaccess


Related guidesEdit

ReferencesEdit

Around Wikia's network

Random Wiki