Getting error as failed to execute /bin/bash : Permission denied for ssh and su commands.

Solution Verified - Updated -

Issue

  • While trying to putty or ssh from terminal to non-root users, getting error below and ssh session gets terminated.

    $ ssh -vvv username@server-ip
    /bin/bash : Permission denied
    
  • For su to non-root user, getting similar errors

    # su - username
    Failed to execute /bin/bash : Permission denied
    
  • The /var/log/secure file shows connection closed by user.

Environment

  • Red Hat Enterprise Linux 7
  • Red Hat Enterprise Linux 8
  • Red Hat Enterprise Linux 9

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content