Avatar of Xetroximyn
Xetroximyn
Flag for United States of America asked on

Mac telnet client seems to skip part of login script?

I have no idea how but it seems like a mac telnet client is skipping part of our login script.  We use tcsh and at the bottom of .login I have a section that executes and asks some questions and drops a person in some software instead of a command prompt.  But I see the person at the command prompt instead.

Any ideas?
Shell ScriptingSSH / Telnet SoftwareLinux

Avatar of undefined
Last Comment
Xetroximyn

8/22/2022 - Mon
Duncan Roe

Sounds like something in the environment exported by the Mac. Would need to see your .login to say any more.
Xetroximyn

ASKER
Here is the most relevant section that seems to be skipped

if ($USER == "client") then
    fixsuper
    fixsuper
    fixsuper
    cd /usr/cfmc/jobs
    clear
    tryagain:
    set jobfolder = ""
    echo    " "
    echo    " "
    echo    "   Please enter the JOB FOLDER from the instructions"
    echo    " "
    echo    "   or type 'abort' to logout"
    echo    " "
    echo -n " --> "
    set jobfolder = `head -1`
    if ( `echo ${jobfolder} | grep -c "abort"` ) then
        logout
    endif
    if ( ${jobfolder} == "" ) then
        clear
        goto tryagain
    endif

    set studycode = ""
    echo    " "
    echo    " "
    echo    "   Please enter the STUDY CODE from the instructions"
    echo    " "
    echo    "   or type 'abort' to logout"
    echo    " "
    echo -n " --> "
    set studycode = `head -1`
    if ( `echo ${studycode} | grep -c "abort"` ) then
        logout
    endif
    if ( ${studycode} == "" ) then
        clear
        goto tryagain
    endif

    if ( { ls /usr/cfmc/jobs/${jobfolder} } == "1" ) then
        clear
        cd ${jobfolder}
        if ( { ls /usr/cfmc/jobs/${jobfolder}/test } == "1" ) then
            clear
            cd test
            survent "init:${studycode};dbug;yes"
        else
            clear
            netsurv "init:${studycode};dbug;yes"
        endif
    else
        clear
        echo    " "
        echo    " It appears that job does not exist on the system"
        echo    " "
        echo    " Check the instructions and try again"
        echo    " "
        echo    " If you continue to have issues let us know"
        echo    " "
        echo    " "
        goto tryagain
    endif
    echo    " "
    echo    " "
    echo    " press enter to logout"
    echo    " "
    set logout = `head -1`
    logout
endif

Open in new window

ozo

shouldn't that be
if [ $USER == "client" ] ; then
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Xetroximyn

ASKER
This is actually csh/tcsh which has different IF syntax than bash.  Also this code works fine when people telnet from windows... but not mac.
ASKER CERTIFIED SOLUTION
Duncan Roe

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
Tintin

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
Duncan Roe

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Xetroximyn

ASKER
Thanks!  Iam trying to get the mac user to list their env so I can check
Duncan Roe

You could put a line at the head of .login such as env>/tmp/$PPID.env - that will tell you all you need to know. (The process ID will be that of the in.telnetd invocation)
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Xetroximyn

ASKER
hmmm... seems it does not work.  If I login, no file is made.  If i do
source .login
in an existing window a file is made... any ideas?
Duncan Roe

Not executing .login may be your problem. man tcsh tells me that it ought to be executed, at least if your login shell (in /etc/passwd) is /bin/tcsh or /bin/csh. Users may change their login shells using chsh - you might want to check that they haven't done that.

env>/tmp/$PPID.env is bash syntax - maybe you need to adjust for tcsh? But you did say it worked when you sourced it.
Xetroximyn

ASKER
dur... So there are a number of users that share a login script... I forgot I recently separated my user from that, so I was not using the login script... it is in fact working.   Now I just need to get a mac user to login... (they are so rare.... most of our clients use windows)
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23