2

I was implementing a series of recommendations to 'harden' my linux server, involving lots and lots of changes. Linux is CentOS 6.2, kernel 2.6.32-220.*.

I'm currently using tty2..tty5 (no X/GUI etc) switching between them via Ctrl+Alt+F?.

Now when I login as root in a tty, I find I am in 'bash restricted mode'.

The first thing I checked was /etc/passwd which still has root:x:0:0:root:/root:/bin/bash as the first line.

My question is this:

Apart from invoking the root shell with /bin/rbash (which didn't exist) or /bin/bash -r is there any other way that bash can be defaulted to restricted mode?

For example:

  1. If a particular file is unreadable or unexecutable, will bash start in restricted mode? If so, which file(s)?

  2. Could this happen if I've botched up the SELinux security context for a particular file? (Policy is 'targeted')

I haven't listed the changes since there are far too many, my fault

rx

nb: shell is definitely bash, since running '# ps ' lists only "bash & ps" ...

  • No missing file could cause bash to run in restricted mode. A strange user database or PAM configuration might cause a different shell to be picked instead of the indication in /etc/passwd, but I don't know what to look at beyond the PAM configuration, generally speaking. – Gilles Mar 27 '12 at 22:01
  • Thanks, @@Giles. (Just got back from the run), I'll look thru the PAM config &c – Ras Xhufu Mar 27 '12 at 23:12
1

Maybe set -r in ~/.bashrc, in /etc/profile or in a file called by one of the previous (as /etc/bash.bashrc).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.