2

I've made a new alias in the remote machine /.bashrc, since I did it and I close the session I just can't log in again using the shh protocol. As you can see in the code, when I try to log in, the machine prompts a error with the alias, it doesn't let you to type anything and few minutes later the connection is closed.

name@user2:~$ ssh [email protected]
[email protected] password: 
/home/user/.bashrc: line 18: alias: /data/user/remotename/software/env-shell.sh: not found

Connection closed by UNKNOWN port 65432

I would like to know if there is a solution with no direct access to the remote machine?

Pd: I can't delete the alias anymore and I can't be 100% sure that the problem is due to the alias.

1
  • What does this show? less /etc/ssh/sshd_config Is the new alias on that list? Try this ssh [email protected] -v Oct 21, 2019 at 16:34

1 Answer 1

2

If the problem is within your ~/.bashrc file, then any of the following should work:

  1. open an interactive bash shell in place of the default login shell, but skip the rc files

    ssh -t [email protected] 'bash --norc'
    
  2. open a different interactive shell that doesn't read ~/.bashrc

    ssh -t [email protected] '/bin/sh'
    
  3. open your remote user's ~/.bashrc for editing directly so that you can fix it

    ssh -t [email protected] 'nano ~/.bashrc'
    

The -t requests allocation of a tty so that you can execute interactive commands without invoking the usual login shell.

1
  • I've just tried the third one, deleted the alias and now everything works perfectly! Many thanks!! :)
    – Pablo Ruiz
    Oct 21, 2019 at 17:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .