Skip to main content
Rollback to Revision 1 - Edit approval overridden by post owner or moderator
Source Link
LetMeSOThat4U
  • 1.6k
  • 4
  • 28
  • 49

At the end of .bashrc I added:

touch /tmp/bash_noninteractive_test 

Run:

/usr/bin/ssh -v -C [email protected] 'ls' 

On the host (logged in interactively before):

% ls -l /tmp/bash_noninteractive_test ls: cannot access /tmp/bash_noninteractive_test: No such file or directory 

I thought ~./bashrc is ALWAYS sourced in non-interactive shells, like over SSH? How do I fix that?

Systems affected:

% lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 14.04.5 LTS Release: 14.04 Codename: trusty 

and

 % lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 8.11 (jessie) Release: 8.11 Codename: jessie 

At the end of .bashrc I added:

touch /tmp/bash_noninteractive_test 

Run:

/usr/bin/ssh -v -C [email protected] 'ls' 

On the host (logged in interactively before):

% ls -l /tmp/bash_noninteractive_test ls: cannot access /tmp/bash_noninteractive_test: No such file or directory 

I thought ~./bashrc is ALWAYS sourced in non-interactive shells, like over SSH? How do I fix that?

Systems affected:

% lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 14.04.5 LTS Release: 14.04 Codename: trusty 

and

% lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 8.11 (jessie) Release: 8.11 Codename: jessie 

At the end of .bashrc I added:

touch /tmp/bash_noninteractive_test 

Run:

/usr/bin/ssh -v -C [email protected] 'ls' 

On the host (logged in interactively before):

% ls -l /tmp/bash_noninteractive_test ls: cannot access /tmp/bash_noninteractive_test: No such file or directory 

I thought ~./bashrc is ALWAYS sourced in non-interactive shells, like over SSH? How do I fix that?

Systems affected:

% lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 14.04.5 LTS Release: 14.04 Codename: trusty 
 % lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 8.11 (jessie) Release: 8.11 Codename: jessie 
Fixing wrong code block formatting (see https://i.sstatic.net/bX2nW.png )
Source Link

At the end of .bashrc I added:

touch /tmp/bash_noninteractive_test 

Run:

/usr/bin/ssh -v -C [email protected] 'ls' 

On the host (logged in interactively before):

% ls -l /tmp/bash_noninteractive_test ls: cannot access /tmp/bash_noninteractive_test: No such file or directory 

I thought ~./bashrc is ALWAYS sourced in non-interactive shells, like over SSH? How do I fix that?

Systems affected:

% lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 14.04.5 LTS Release: 14.04 Codename: trusty 

and

 % lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 8.11 (jessie) Release: 8.11 Codename: jessie 

At the end of .bashrc I added:

touch /tmp/bash_noninteractive_test 

Run:

/usr/bin/ssh -v -C [email protected] 'ls' 

On the host (logged in interactively before):

% ls -l /tmp/bash_noninteractive_test ls: cannot access /tmp/bash_noninteractive_test: No such file or directory 

I thought ~./bashrc is ALWAYS sourced in non-interactive shells, like over SSH? How do I fix that?

Systems affected:

% lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 14.04.5 LTS Release: 14.04 Codename: trusty 
 % lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 8.11 (jessie) Release: 8.11 Codename: jessie 

At the end of .bashrc I added:

touch /tmp/bash_noninteractive_test 

Run:

/usr/bin/ssh -v -C [email protected] 'ls' 

On the host (logged in interactively before):

% ls -l /tmp/bash_noninteractive_test ls: cannot access /tmp/bash_noninteractive_test: No such file or directory 

I thought ~./bashrc is ALWAYS sourced in non-interactive shells, like over SSH? How do I fix that?

Systems affected:

% lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 14.04.5 LTS Release: 14.04 Codename: trusty 

and

% lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 8.11 (jessie) Release: 8.11 Codename: jessie 
Tweeted twitter.com/ServerFault/status/1403502378943385611
Source Link
LetMeSOThat4U
  • 1.6k
  • 4
  • 28
  • 49

~/.bashrc is NOT sourced on ssh 'command'

At the end of .bashrc I added:

touch /tmp/bash_noninteractive_test 

Run:

/usr/bin/ssh -v -C [email protected] 'ls' 

On the host (logged in interactively before):

% ls -l /tmp/bash_noninteractive_test ls: cannot access /tmp/bash_noninteractive_test: No such file or directory 

I thought ~./bashrc is ALWAYS sourced in non-interactive shells, like over SSH? How do I fix that?

Systems affected:

% lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 14.04.5 LTS Release: 14.04 Codename: trusty 
 % lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 8.11 (jessie) Release: 8.11 Codename: jessie