1

I have user test and I want to provide a bash script as a login shell for this user. I was able to do it on centOS 6 easily by using the command usermod -s /pathtomyscript.sh. But in centOS 7 I am unable to do it like this. I copied the script to /usr/bin and added it to /etc/shells. But still no luck. My script is the following:

#!/bin/bash PATH=$PATH:$HOME/.local/bin:$HOME/bin:/usr/bin:/bin export PATH whiptail --title "Example Dialog" --msgbox "You are logged in and now click ok to exit!" 8 78 

I am able to login by running su, but when I login into console, it is saying that no shell, permission denied. I have already given the proper permission to the file like the following:

-rwxr-xr-x. 1 test test 240 Jan 19 15:57 /usr/bin/testshell.sh 
2
  • 1
    Maybe research SELinux, in particular grep | audit2allow Commented Jan 19, 2017 at 16:29
  • 1
    What is the exact error message displayed or in your logs ? Commented Jan 19, 2017 at 17:32

1 Answer 1

2

If you need, to some script or program acts as user's login shell - you must append it's full path to /etc/shells file.

pam_shells module checks for user login shell in this file.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.