Im getting below error printed while doing SSH to an ubuntu 20 server. no remote command is executed over ssh.
ubuntu@ip-x-x-x-x:~$ /usr/bin/ssh [email protected]
###############################################################
# Authorized access only! #
# Disconnect IMMEDIATELY if you are not an authorized user!!! #
# All actions Will be monitored and recorded #
###############################################################
Last login: Thu Dec 8 05:58:57 2022 from x.x.x.x
-e: command not found
-e: command not found
-e: command not found
-e: command not found
-e: command not found
-e: command not found
-e: command not found
-e: command not found
-e: command not found
-e: command not found
-e: command not found
-e: command not found
-e: command not found
-e: command not found
-e: command not found
-e: command not found
-e: command not found
-e: command not found
-e: command not found
-e: command not found
-e: command not found
-e: command not found
-e: command not found
-e: command not found
ubuntu@given-hostname:~$
Nothings on profile.d or ssh configs that I could find. Does anyone know the source to look for?
2
Answers
When you login to remote server – the shell’s log in script is executed (it’s located in /home/user/ if you ssh to user@remote, i.e. on given-hostname->/home/ubuntu when ubuntu@given-hostname).
You can check what shell is executed for that user on remote host:
If it’s bash, the ~/.profile ~/.bashrc ~/.bash_profile are executed (on remote host) on login and in your case some of these contain some command that produces "-e: command not found" – it’s impossible to say which without looking into that script files. Check mentioned files for line(s) containing "-e".
It’s a common issue if you use -e flag with echo in bash scripts and then call it with sh, it’s for enabling interpretation of backslash escapes, like
echo -e "e[0;32mThis text will be green.e[0m"
, but this option is default in sh so it can’t understand it.