<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic rc file for ssh in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/rc-file-for-ssh/m-p/3252381#M749172</link>
    <description>I have a script that works fine for ssh but not scp, the who command does not work without a tty.&lt;BR /&gt;I would like a sollution that works for both ssh and scp?&lt;BR /&gt;&lt;BR /&gt;file /.ssh/rc&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;&lt;BR /&gt;LOGIN_HOST=$(who -um | awk '{print $NF}')&lt;BR /&gt;&lt;BR /&gt;case $LOGIN_HOST in&lt;BR /&gt;'system hostname')&lt;BR /&gt;        echo "OK"&lt;BR /&gt;        ;;&lt;BR /&gt;'system ip')&lt;BR /&gt;        echo "OK"&lt;BR /&gt;        ;;&lt;BR /&gt;*)&lt;BR /&gt;        KILL_PTS=$(who -um | awk '{print $2}')&lt;BR /&gt;        LOGOUT=$(ps -ef | grep $KILL_PTS | grep -v grep | grep sshd | awk '{print $2}')&lt;BR /&gt;        kill -9 $LOGOUT&lt;BR /&gt;        ;;&lt;BR /&gt;esac&lt;BR /&gt;</description>
    <pubDate>Mon, 19 Apr 2004 10:00:08 GMT</pubDate>
    <dc:creator>Jannik Tonsberg_2</dc:creator>
    <dc:date>2004-04-19T10:00:08Z</dc:date>
    <item>
      <title>rc file for ssh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/rc-file-for-ssh/m-p/3252381#M749172</link>
      <description>I have a script that works fine for ssh but not scp, the who command does not work without a tty.&lt;BR /&gt;I would like a sollution that works for both ssh and scp?&lt;BR /&gt;&lt;BR /&gt;file /.ssh/rc&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;&lt;BR /&gt;LOGIN_HOST=$(who -um | awk '{print $NF}')&lt;BR /&gt;&lt;BR /&gt;case $LOGIN_HOST in&lt;BR /&gt;'system hostname')&lt;BR /&gt;        echo "OK"&lt;BR /&gt;        ;;&lt;BR /&gt;'system ip')&lt;BR /&gt;        echo "OK"&lt;BR /&gt;        ;;&lt;BR /&gt;*)&lt;BR /&gt;        KILL_PTS=$(who -um | awk '{print $2}')&lt;BR /&gt;        LOGOUT=$(ps -ef | grep $KILL_PTS | grep -v grep | grep sshd | awk '{print $2}')&lt;BR /&gt;        kill -9 $LOGOUT&lt;BR /&gt;        ;;&lt;BR /&gt;esac&lt;BR /&gt;</description>
      <pubDate>Mon, 19 Apr 2004 10:00:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/rc-file-for-ssh/m-p/3252381#M749172</guid>
      <dc:creator>Jannik Tonsberg_2</dc:creator>
      <dc:date>2004-04-19T10:00:08Z</dc:date>
    </item>
    <item>
      <title>Re: rc file for ssh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/rc-file-for-ssh/m-p/3252382#M749173</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;If you want to know if ksh is executed in interactive mode use this test :&lt;BR /&gt;&lt;BR /&gt;if [[ -o interactive ]] ; then&lt;BR /&gt;    ...&lt;BR /&gt;else&lt;BR /&gt;    ...&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Cheers &lt;BR /&gt;&lt;BR /&gt;Nicolas</description>
      <pubDate>Mon, 19 Apr 2004 22:21:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/rc-file-for-ssh/m-p/3252382#M749173</guid>
      <dc:creator>Nicolas Dumeige</dc:creator>
      <dc:date>2004-04-19T22:21:55Z</dc:date>
    </item>
    <item>
      <title>Re: rc file for ssh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/rc-file-for-ssh/m-p/3252383#M749174</link>
      <description>for the information:&lt;BR /&gt;This is a script that will let root in for a sincle server. This script will not affect other protocols as telnet :-).&lt;BR /&gt;&lt;BR /&gt;With the script:&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;&lt;BR /&gt;if [[ -o interactive ]]&lt;BR /&gt;then&lt;BR /&gt;        echo "STATEMENT 1"&lt;BR /&gt;else&lt;BR /&gt;        echo "STATEMENT 2"&lt;BR /&gt;        LOGIN_HOST=$(who -um | awk '{print $NF}')&lt;BR /&gt;&lt;BR /&gt;        case $LOGIN_HOST in&lt;BR /&gt;        '&lt;SERVER&gt;')&lt;BR /&gt;                echo "OK"&lt;BR /&gt;                ;;&lt;BR /&gt;        '&lt;IP&gt;')&lt;BR /&gt;                echo "OK"&lt;BR /&gt;                ;;&lt;BR /&gt;        *)&lt;BR /&gt;                KILL_PTS=$(who -um | awk '{print $2}')&lt;BR /&gt;                LOGOUT=$(ps -ef | grep $KILL_PTS | grep -v grep | grep sshd | awk '{print $2}')&lt;BR /&gt;                kill -9 $LOGOUT&lt;BR /&gt;                ;;&lt;BR /&gt;        esac&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;I get the following output on scp:&lt;BR /&gt;root@&lt;SERVER&gt;'s password:&lt;BR /&gt;STATEMENT 2&lt;BR /&gt;$ process not attached to terminal&lt;BR /&gt;&lt;BR /&gt;for ssh i get the following output:&lt;BR /&gt;$ ssh -l root &lt;SERVER&gt;&lt;BR /&gt;root@&lt;SERVER&gt;'s password:&lt;BR /&gt;STATEMENT 2&lt;BR /&gt;OK&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;so the:&lt;BR /&gt;if [[ -o interactiv ]]&lt;BR /&gt;doesn't work&lt;/SERVER&gt;&lt;/SERVER&gt;&lt;/SERVER&gt;&lt;/IP&gt;&lt;/SERVER&gt;</description>
      <pubDate>Tue, 20 Apr 2004 02:27:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/rc-file-for-ssh/m-p/3252383#M749174</guid>
      <dc:creator>Jannik Tonsberg_2</dc:creator>
      <dc:date>2004-04-20T02:27:49Z</dc:date>
    </item>
  </channel>
</rss>

