[colug-432] Okay, I've got to be doing something stupid... any thoughts on what?
Rick Hornsby
richardjhornsby at gmail.com
Fri Jul 10 17:21:23 EDT 2015
> On Jul 10, 2015, at 16:06, William Yang <wyang at gcfn.net> wrote:
>
> I'm using a Centos 7 box -- noting that I'm usually an Ubuntu guy nowadays.
>
> To solve a specific problem, I've written a PERL script that I want to be
> the login shell of a user (the script manages several configuration
> functions and its expected use case is on one of the consoles). The script
> does all functions I expect it to. The first line of the script is '#!
> /usr/bin/perl' and it's chmod 0755.
>
> It works if I ssh onto the box as the user: ssh menu at host starts as
> expected. However, if I try to log in on tty1 or anything on the console,
> it displays stuff from login, then the console blanks and returns to a
> login prompt. There's some kind of error message that looks like it may
> say permission denied, but the screen refreshes and clears too quickly for
> me to really understand it. I tried for 90 minutes to get it to happen in
> a way I could capture it, without success.
I may have missed it here, but what happens when you're logged in as a normal user and you
sudo su - testuser
?
Is there a difference if you're logged in (originally) via ssh or through the terminal and then su to the other user?
I'm most likely wrong, but somewhere in the cobwebs of my mind is a thought about the difference between real and virtual ttys. Don't remember what that means but maybe it will jog someone else's memory.
The other thing even further back in the cobwebs is something about a list of allowed shells somewhere?
> When I modified the script to 'printf("testing\n"); sleep(10);' at the
> beginning, I never saw the output, which makes me think the script isn't
> running.
>
> Setting rsyslog to log *.debug to a file doesn't show me anything that
> jumps out at me.
>
> I checked the pam configs and don't see anything that should restrict it.
>
> While I could address this by setting the shell to something like
> /bin/rbash and writing the perl invocation into .bash_profile, that's not
> what I really want to do. I'm confused as to why it's failing to invoke on
> the console, but not via ssh. I used to use scripts as login shells all
> the time.
Right. IIRC it's easier to break out of that into a normal shell prompt - not what you want.
-rj
More information about the colug-432
mailing list