The role of shells in the Linux environment
Shell is used for various purposes under Linux. Linux user environment is made of the following components:
- Kernel – The core of Linux operating system.
- Shell – Provides an interface between the user and the kernel.
- Terminal emulator – The xterm program is a terminal emulator for the X Window System. It allows user to enter commands and display back their results on screen.
- Linux Desktop and Windows Manager – Linux desktop is collection of various software apps. It includes the file manger, the windows manager, the Terminal emulator and much more. KDE and Gnome are two examples of the complete desktop environment in Linux.
Login
User can login locally into the console when in runlevel # 3 or graphically when in runlevel # 5 (the level numbers may differ depending on the distribution). In both cases you need to provide username and password. Bash uses the following initialization and start-up files:
- /etc/profile – The systemwide initialization file, executed for login shells.
- /etc/bash.bashrc – The systemwide per-interactive-shell startup file. This is a non-standard file which may not exist on your distribution. Even if it exists, it will not be sourced unless it is done explicitly in another start-up file.
- /etc/bash.logout – The systemwide login shell cleanup file, executed when a login shell exits.
- $HOME/.bash_profile – The personal initialization file, executed for login shells.
- $HOME/.bashrc – The individual per-interactive-shell startup file.
- $HOME/.bash_logout – The individual login shell cleanup file, executed when a login shell exits.
- $HOME/.inputrc – Individual readline initialization file.
Bash Startup Scripts
Script of commands executed at login to set up environment. For example, setup JAVA_HOME path.
Login Shell
Login shells are first shell started when you log in to the system. Login shells set environment which is exported to non-login shells. Login shell calls the following when a user logs in:
- /etc/profile runs first when a user logs in runlevel # 3 (the level numbers may differ depending on the distribution).
- $HOME/.bash_profile, $HOME/.bash_login, and $HOME/.profile, runs second when a user logs in in that order. $HOME/.bash_profile calls $HOME/.bashrc, which calls /etc/bashrc (/etc/bash.bashrc).
Non-Login Shell
- When an interactive shell that is not a login shell is started, bash reads and executes commands from /etc/bash.bashrc or /etc/bashrc and $HOME/.bashrc, if these files exist. First, it calls $HOME/.bashrc. This calls /etc/bash.bashrc, which calls /etc/profile.d.
Bash Logout Scripts
- When a login shell exits, bash reads and executes commands from the file $HOME/.bash_logout, if it exists.
Source: Cybercitiz
By default any modern Linux distributions will have IP Forwarding disabled. This is normally a good idea, as most peoples will not need IP Forwarding, but if we are setting up a Linux router/gateway or maybe a VPN server (pptp or ipsec) or just a plain dial-in server then we will need to enable forwarding. This can be done in several ways that I will present bellow.
Rsync is a program for synchronizing two directory trees across different file systems even if they are on different computers. It can run its host to host communications over ssh to keep things secure and to provide key based authentication. If a file is already present in the target and is the same as on the source the file will not be transmitted. If the file on the target is different than the one on the source then only the parts of it that are different are transferred. These features greatly increase the performance of rsync over a network.