<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Thanks for sharing a fun challenge. <br>
Methinks it's an environment problem. SSHD and LOGIN set the
environment differently. So maybe something in (or lacking from)
the TTY environment is choking Perl. <br>
<br>
There is <font face="Courier New, Courier, monospace">/etc/environment</font>
which on my SUSE system is commented to be handled by <font
face="Courier New, Courier, monospace">pam_env</font>. SSHD may
or may not drive PAM. Check <font face="Courier New, Courier,
monospace">/etc/ssh/sshd_config</font> for related settings. <br>
<br>
Would be good to catch that error message before it vanishes. <br>
I suggest wrapping the Perl script in a shell script with an
explicit <font face="Courier New, Courier, monospace">/bin/sleep
5</font> (or whatever time you want) before the end. <br>
<br>
<br>
<br>
On 07/10/2015 05:06 PM, William Yang wrote:<br>
</div>
<blockquote cite="mid:55A033C5.8090008@gcfn.net" type="cite">
<pre wrap="">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@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.
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.
Anyone have any thoughts on what's going on?
        -Bill
</pre>
</blockquote>
<br>
</body>
</html>