If I su user
from my home directory I am getting a permission denied for bash-completion, but if I su user
from another directory there is no error.
Can't locate strict.pm: lib/strict.pm: Permission denied at
/usr/bin/vendor_perl/bash-complete line 7.
BEGIN failed--compilation aborted at /usr/bin/vendor_perl/bash-complete line 7.
Line 7 of the referenced file is use strict;
... included with every version of perl since at least the late 90s.
su user
sources /etc/bash.bashrc
and the user being su'd to .bashrc
. Why would the calling user's location in the filesystem change this?
See my repo for more details, but I think I've gotten the necessary basics here.
Edit: More description of the setup.
I've added the following lines to /etc/bash.bashrc (which is where the error is happening):
if [[ $USER == 'testloginfiles' ]]; then
echo "/etc/bash.bashrc (-: $-) ($(shopt login_shell))"
printf '@INC: %s\n' $(perl -e 'print join ":", @INC')
fi
And this is the output if I am in my home directory:
$ pwd;su testloginfiles
/home/harleypig
Password:
/etc/bash.bashrc (-: himBH) (login_shell off)
@INC: lib:/usr/lib/perl5/5.28/site_perl:/usr/share/perl5/site_perl:/usr/lib/perl5/5.28/vendor_perl:/usr/share/perl5/vendor_perl:/usr/lib/perl5/5.28/core_perl:/usr/share/perl5/core_perl
Can't locate strict.pm: lib/strict.pm: Permission denied at /usr/bin/vendor_perl/bash-complete line 7.
BEGIN failed--compilation aborted at /usr/bin/vendor_perl/bash-complete line 7.
/home/testloginfiles/.bashrc (-: himBH) (login_shell off)
[testloginfiles@sweetums harleypig]$
If I am in another directory (e.g., /tmp
) I get the following:
$ pwd ; su testloginfiles
/tmp
Password:
/etc/bash.bashrc (-: himBH) (login_shell off)
@INC: lib:/usr/lib/perl5/5.28/site_perl:/usr/share/perl5/site_perl:/usr/lib/perl5/5.28/vendor_perl:/usr/share/perl5/vendor_perl:/usr/lib/perl5/5.28/core_perl:/usr/share/perl5/core_perl
/home/testloginfiles/.bashrc (-: himBH) (login_shell off)
[testloginfiles@sweetums tmp]$
There is a relative path as @pcronin suggests, but neither my home directory nor /tmp
have a lib directory. Why is one causing an error and the other is not?