Ubuntu 12.04 and I have set up a user's shell to
/bin/bash - but when it is invoked it runs
/etc/bash.bashrc instead of
If you haven't used
jailkit before here's the gist of it:
- A "jailed" version of the system root is created somewhere, like /home/jail
- Jailed users home directories are moved inside that folder like /home/jail/home/testuser
- Relavant configuration files are copied to /home/jail/etc/ - including a limited /etc/passwd
- Programs that you want to allow access to are copied to the corresponding directories, like /bin/bash
- When a jailed user logs in they are chrooted to /etc/jail/ and can't see any files above that
So I have a
testuser who has an entry in
/etc/passwd like this:
In the file
/home/jail/etc/passwd there is an entry like:
I've read though the
bash(1) and so I think the problem is that bash thinks it is not being invoked as a login shell:
When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists.
I get that
bash is actually being invoked by
/usr/sbin/jk_chrootsh but I don't understand how
bash is determining what type of shell it is, and what set of startup files it should run.
I'd like to see if I can troubleshoot this - but I don't understand:
How does bash know how it is being invoked?
ps: I also looked into
login(1) without much luck.