He said, he logs in as user X on the same machine, so it shouldn't be the user, nor the users shell setting.
man telnet wrote:
ENVIRONMENT
Telnet uses at least the HOME, SHELL, DISPLAY, and TERM environment variables. Other environment vari‐
ables may be propagated to the other side via the TELNET ENVIRON option.
man sshd wrote:LOGIN PROCESS
When a user successfully logs in, sshd does the following:
1. If the login is on a tty, and no command has been specified, prints last login time and...
9. Runs user's shell or command.
I don't see an obvious difference here, but which configfile is read or isn't may differ, and in the end the configfile might evaluate, if it is called from ssh or telnet.
You may put some
and so on in .bashrc, /etc/bash.bashrc and so on, to see, which one is invoked, or search, where "." is added to the path.