I had this problem years ago. And it cropped up again, a few days ago. I didn’t write it down then…
Symptom: bash aliases work if I am logged in as a local user. However, if you use ssh to gain access, the bash aliases are gone!
What’s happening? Actually it is very easy to fix. You simply need to add the .profile file to your home directory. The profile file is something that is executed each time you login. It is like the old Windows autoexec.bat file.
Here is the text for the file, and an addition I made to make life easier. Using a text editor of choice (gedit, nano, or….vi) create a .profile file.
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
#
# add /sbin to the path so we can use things like ifconfig
# without have to do sudo or getting
# bash: ifconfig: No such file or directory
# PATH="$HOME/bin:$PATH"
#
PATH="$HOME/bin:/sbin:$PATH"
fi
After you create the file, log out, and back in again, and the bash aliases will work over ssh.
Related Articles
No user responded in this post