Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2039
  • Last Modified:

Can the /etc/passwd file have a script instead of shell for login-shell on RedHat Enterprise Linux 6.4

On an older RedHat EL 4.6 server, /etc/passwd has a script instead of a shell in the login-shell field. This was for security reasons, so the user could not get into bash.
For example: user:x:520:501:comment:/home/:/usr/local/bin/online_users.sh

Is it possible to do on a Red Hat EL 6.4 server? I tried it,  but the user gets access denied when she tries to log in. Do I need to set something else up? The user will always be using /bin/bash shell.
0
penguins_rule
Asked:
penguins_rule
  • 4
  • 2
  • 2
  • +1
4 Solutions
 
savoneCommented:
If they do not have a shell they will not be able to log in.

How is the user logging in? Via SSH, GUI, SFTP??
0
 
penguins_ruleAuthor Commented:
If the online_users.sh exists in their /home directory, then it works.
I am having a problem with access control (acl) and permissions. So, I will see what happens once I get that straightened out.

To answer savone: The users log in using putty on a windows PC.
0
 
savoneCommented:
I don't know what is in online_users.sh, but they will need a valid shell to login via SSH.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
gheistCommented:
You need binary program as shell
/bin/true /bin/false and /sbin/nologin are good noop-shells.
0
 
penguins_ruleAuthor Commented:
Is it possible to change something in PAM auth to allow any shell?
0
 
Harisha M GCommented:
Check a these things to begin:

1. Whether the script has execute permission for the user?
2. Whether the script is accessible for the user?
3. Whether the user gets the same error when he tries to run the script after logging in?
0
 
gheistCommented:
You can enter any program in /etc/shells
0
 
penguins_ruleAuthor Commented:
Listing the script in /etc/shells did not work because it could not run /bin/bash
The user had no problem running the script after logging in when the /etc/passwd login program was /bin/bash
As far as I could tell, the directories and script had the group set correctly and the script was executable

I was able to create a little script initial_script.sh in the user's home directory and then set the login shell in /etc/passwd to it

>cat /home/user/initial_script.sh
#!/bin/bash
source /usr/local/bin/online_users.sh
exit
0
 
penguins_ruleAuthor Commented:
With information from the experts, I was able to come up with a way to do what i needed to do. Because I did not want to give them access to the shell, this was the method used.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 4
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now