using ssh from macbook - Ubuntu

This is a discussion on using ssh from macbook - Ubuntu ; I am using ssh on my macbook to connect to my Linux server. Since OSX is much like linux, I do an xhost + when I start up a terminal so that I can connect to the X system running. ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: using ssh from macbook

  1. using ssh from macbook

    I am using ssh on my macbook to connect to my Linux
    server. Since OSX is much like linux, I do an xhost +
    when I start up a terminal so that I can connect to the X system
    running.

    I use ssh to connect to my Linux (Mepis32) box and
    would like to be able to tell if I am currently ssh'd
    from my macbook so that I can use apps (i.e. Eclipse) which
    rely on the X system.

    I wrote a little piece of code and put it in my .bashrc

    pcount=`netstat -nat | grep 192.168.2.13 | grep tcp | wc -l`
    if [[ $pcount -gt 0 ]]
    then
    export DISPLAY=macbook:0.0
    fi

    It works but I'm wondering if there is an easier way ie.

    if [[ ssh_from_ip = "192.168.2.13" ]]
    then
    ....
    fi

    or better yet.... something using my /etc/host file.
    I already have an entry in /etc/host for all the machines on my network
    so there must be a way to use that information to determine where I
    am coming from.

    --
    Do you twitter? http://twitter.com
    Do you want to be a cranky geek? http://www.crankygeeks.com/
    Improving the usenet experience: http://improve-usenet.org/ (I score GG down to 8999)
    RLU #451587 http://counter.li.org/estimates.php

  2. Re: using ssh from macbook

    On Tue, 16 Sep 2008 20:04:27 +0000, John wrote:

    > I am using ssh on my macbook to connect to my Linux server. Since OSX
    > is much like linux, I do an xhost + when I start up a terminal so that I
    > can connect to the X system running.
    >
    > I use ssh to connect to my Linux (Mepis32) box and would like to be able
    > to tell if I am currently ssh'd from my macbook so that I can use apps
    > (i.e. Eclipse) which rely on the X system.
    >
    > I wrote a little piece of code and put it in my .bashrc
    >
    > pcount=`netstat -nat | grep 192.168.2.13 | grep tcp | wc -l` if [[
    > $pcount -gt 0 ]]
    > then
    > export DISPLAY=macbook:0.0
    > fi
    >
    > It works but I'm wondering if there is an easier way ie.
    >
    > if [[ ssh_from_ip = "192.168.2.13" ]] then
    > ....
    > fi
    >
    > or better yet.... something using my /etc/host file. I already have an
    > entry in /etc/host for all the machines on my network so there must be a
    > way to use that information to determine where I am coming from.


    You don't need xhost +, you should be turning on X forwarding in ssh. On
    the client side make sure that your .ssh/config file contains,

    Host *
    ForwardX11 yes
    ForwardX11Trusted yes
    StrictHostKeyChecking no
    ForwardAgent yes

    On the server side make sure that /etc/ssh/sshd_config contains

    X11Forwarding yes


  3. Re: using ssh from macbook

    On 2008-09-16, General Schvantzkopf wrote:
    > On Tue, 16 Sep 2008 20:04:27 +0000, John wrote:
    >
    >> I am using ssh on my macbook to connect to my Linux server. Since OSX
    >> is much like linux, I do an xhost + when I start up a terminal so that I
    >> can connect to the X system running.
    >>
    >> I use ssh to connect to my Linux (Mepis32) box and would like to be able
    >> to tell if I am currently ssh'd from my macbook so that I can use apps
    >> (i.e. Eclipse) which rely on the X system.
    >>
    >> I wrote a little piece of code and put it in my .bashrc
    >>
    >> pcount=`netstat -nat | grep 192.168.2.13 | grep tcp | wc -l` if [[
    >> $pcount -gt 0 ]]
    >> then
    >> export DISPLAY=macbook:0.0
    >> fi
    >>
    >> It works but I'm wondering if there is an easier way ie.
    >>
    >> if [[ ssh_from_ip = "192.168.2.13" ]] then
    >> ....
    >> fi
    >>
    >> or better yet.... something using my /etc/host file. I already have an
    >> entry in /etc/host for all the machines on my network so there must be a
    >> way to use that information to determine where I am coming from.


    env | grep SSH

    sample output

    SSH_CLIENT=10.0.0.2 46264 22
    SSH_TTY=/dev/pts/1
    SSH_CONNECTION=10.0.0.2 46264 75.146.106.188 22

    > You don't need xhost +, you should be turning on X forwarding in ssh. On
    > the client side make sure that your .ssh/config file contains,
    >
    > Host *
    > ForwardX11 yes
    > ForwardX11Trusted yes
    > StrictHostKeyChecking no
    > ForwardAgent yes
    >
    > On the server side make sure that /etc/ssh/sshd_config contains
    >
    > X11Forwarding yes
    >


    That's definitely the preferred approach.

    ssh +Y -l myuserid server.mydomain.com

    --
    Due to extreme spam originating from Google Groups, and their inattention
    to spammers, I and many others block all articles originating
    from Google Groups. If you want your postings to be seen by
    more readers you will need to find a different means of
    posting on Usenet.
    http://improve-usenet.org/

+ Reply to Thread