Shell profile and rc scripts, compared
Part of Guide to the Local System.
This page is for newbies and compares different shell programs as to
how they behave when they start.
What runs when a secure shell scp or sftp is performed
When a client runs a scp or sftp to a server, then on the server:
- User's shell is /bin/sh from bash package:
- no shell profile or rc scripts are run.
- User's shell is /bin/ksh from pdksh package:
- no shell profile or rc scripts are run.
- User's shell is /bin/dash from dash package:
- no shell profile or rc scripts are run.
- User's shell is /bin/bash from bash package:
- The .bashrc script is run.
For a default .bashrc, this means that /etc/bashrc is run:
this sets the umask 022 or 002 according to the User Private Group scheme;
PS1 is not set so code customizing PS1 is skipped;
login_shell is not set so all the /etc/profile.d/*.sh scripts are run!
If the .bashrc script contains any output to standard error,
then for scp this is reproduced on the client session;
for sftp the session closes instead of interacting
in Fedora 12 but works in Red Hat Enterprise 4.
If the .bashrc script contains any output to standard output,
then for scp this is reproduced and the copy does not take place;
for an sftp client the message is Received message too long
and the session closes instead of interacting.
(Any terminal output from a profile or rc script is generally
a bad idea anyway: it can interfere with other commands like "less").
What runs when you login via ssh
What runs when you login via KDE
What runs when you open a new window
What runs when a Torque job starts
to be added soon when time allows .....