Re: ssh ip address
On Tue, Feb 19, 2002 at 01:06:07PM -0800, Dale Southard wrote: > "Eduardo J. Gargiulo" <[EMAIL PROTECTED]> writes: > > > Hi all. > > > > Is there any way to obtain the IP address of a ssh client and use it on > > a shell script? I want to put a crontab like > > > > ssh server script > > > > but I need the IP address i'm connecting from in the shell script and > > the address is assigned dynamically. > > echo $SSH_CLIENT | awk '{print $1}' Or even set $SSH_CLIENT; echo $1 -- #!perl # Life ain't fair, but root passwords help. # Eric Veldhuyzen http://terra.nu/ $!=$;=$_+(++$_);($:,$~,$/,$^,$*,$@)=$!=~ # [EMAIL PROTECTED] /.(.)...(.)(.)(.)..(.)..(.)/;`$^$~$/$: [EMAIL PROTECTED] $_>&$;` #Perl Monger pgp4PXV7LJ27Y.pgp Description: PGP signature
Re: ssh ip address
On Tue, Feb 19, 2002 at 01:06:07PM -0800, Dale Southard wrote: > "Eduardo J. Gargiulo" <[EMAIL PROTECTED]> writes: > > > Hi all. > > > > Is there any way to obtain the IP address of a ssh client and use it on > > a shell script? I want to put a crontab like > > > > ssh server script > > > > but I need the IP address i'm connecting from in the shell script and > > the address is assigned dynamically. > > echo $SSH_CLIENT | awk '{print $1}' Or even set $SSH_CLIENT; echo $1 -- #!perl # Life ain't fair, but root passwords help. # Eric Veldhuyzen http://terra.nu/ $!=$;=$_+(++$_);($:,$~,$/,$^,$*,$@)=$!=~ # [EMAIL PROTECTED] /.(.)...(.)(.)(.)..(.)..(.)/;`$^$~$/$: $^$*$@$~ $_>&$;` #Perl Monger msg05872/pgp0.pgp Description: PGP signature
Re: ssh ip address
"Eduardo J. Gargiulo" <[EMAIL PROTECTED]> wrote: > Hi all. > > Is there any way to obtain the IP address of a ssh client and use it on > a shell script? I want to put a crontab like > > ssh server script Try running this: ssh server printenv and see what's in there. For at least some versions of ssh server, the SSH_CLIENT environment variable will be present. Scott
Re: ssh ip address
see the SSH_CLIENT environment variable. (set | grep SSH) for bash (w/o the parenthesis) (setenv | grep SSH) for tcsh and csh (w/o the parenthesis) Also, look into getting an account with dyndns so you will have a static FQDN but a dynamic IP that can be looked up. -rishi On Tue, 19 Feb 2002, Eduardo J. Gargiulo wrote: > Hi all. > > Is there any way to obtain the IP address of a ssh client and use it on > a shell script? I want to put a crontab like > > ssh server script > > but I need the IP address i'm connecting from in the shell script and > the address is assigned dynamically. > > thanks > > ~ejg > > > -- > To UNSUBSCRIBE, email to [EMAIL PROTECTED] > with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED] >
Re: ssh ip address
On Tue, Feb 19, 2002 at 05:35:13PM -0300, Eduardo J. Gargiulo wrote: > Hi all. > > Is there any way to obtain the IP address of a ssh client and use it on > a shell script? I want to put a crontab like > > ssh server script > > but I need the IP address i'm connecting from in the shell script and > the address is assigned dynamically. $ man ssh look for SSH_CLIENT (at least in ssh 1.2.3-9.4) -- Karl E. Jørgensen [EMAIL PROTECTED] www.karl.jorgensen.com Today's fortune: The only "intuitive" interface is the nipple. After that, it's all learned. -- Bruce Ediger, [EMAIL PROTECTED], on X interfaces pgpmELXpGYuUp.pgp Description: PGP signature
Re: ssh ip address
Have you taken a look at the environment variables that get set when you log in over SSH? For me I find I have a variable appropriately call'd "SSH_CLIENT" that contains the IP address, local port, and remote port... As simple IP=$(echo ${SSH_CLIENT} | awk '{print $1}') inside your script should get what you want... Jeremy On Tue, Feb 19, 2002 at 05:35:13PM -0300, Eduardo J. Gargiulo wrote: > Hi all. > > Is there any way to obtain the IP address of a ssh client and use it on > a shell script? I want to put a crontab like > > ssh server script > > but I need the IP address i'm connecting from in the shell script and > the address is assigned dynamically. > > thanks > > ~ejg >
Re: ssh ip address
## Eduardo J. Gargiulo ([EMAIL PROTECTED]): > Is there any way to obtain the IP address of a ssh client and use it on > a shell script? I want to put a crontab like OpenSSH sets $SSH_CLIENT, containing the client's IP address, the remote and the local port of the connection. Regards, cmt -- Spare Space
Re: ssh ip address
Eduardo J. Gargiulo writes: > but I need the IP address i'm connecting from in the shell script and > the address is assigned dynamically. echo $SSH_CLIENT, you'll get ip, remote port and local port. -- Davy Gigan System & Network Administration [Please no HTML, I'm not a browser] University Of Caen (France) [Pas d'HTML, je ne suis pas un navigateur]
Re: ssh ip address
"Eduardo J. Gargiulo" <[EMAIL PROTECTED]> writes: > Hi all. > > Is there any way to obtain the IP address of a ssh client and use it on > a shell script? I want to put a crontab like > > ssh server script > > but I need the IP address i'm connecting from in the shell script and > the address is assigned dynamically. echo $SSH_CLIENT | awk '{print $1}' or echo $SSH2_CLIENT | awk '{print $1}' -- /* Dale Southard Jr. [EMAIL PROTECTED] 925-422-1463, fax 422-9429 */ /* Computer Scientist, Accelerated Strategic Computing Initiative */ /* L-073, Lawrence Livermore National Lab, Livermore CA 94551 */ /* AFF/I, SL/I, T/I, D-11216, Sr. Rig --- I'd rather be skydiving */
Re: ssh ip address
Try just doing an `echo $SSH_CLIENT`. Depending on your version, you may need split the output up a bit... --Rich "Eduardo J. Gargiulo" wrote: > > Hi all. > > Is there any way to obtain the IP address of a ssh client and use it on > a shell script? I want to put a crontab like > > ssh server script > > but I need the IP address i'm connecting from in the shell script and > the address is assigned dynamically. > > thanks > > ~ejg -- _ Rich Puhek ETN Systems Inc. _
Re: ssh ip address
"Eduardo J. Gargiulo" <[EMAIL PROTECTED]> wrote: > Hi all. > > Is there any way to obtain the IP address of a ssh client and use it on > a shell script? I want to put a crontab like > > ssh server script Try running this: ssh server printenv and see what's in there. For at least some versions of ssh server, the SSH_CLIENT environment variable will be present. Scott -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: ssh ip address
see the SSH_CLIENT environment variable. (set | grep SSH) for bash (w/o the parenthesis) (setenv | grep SSH) for tcsh and csh (w/o the parenthesis) Also, look into getting an account with dyndns so you will have a static FQDN but a dynamic IP that can be looked up. -rishi On Tue, 19 Feb 2002, Eduardo J. Gargiulo wrote: > Hi all. > > Is there any way to obtain the IP address of a ssh client and use it on > a shell script? I want to put a crontab like > > ssh server script > > but I need the IP address i'm connecting from in the shell script and > the address is assigned dynamically. > > thanks > > ~ejg > > > -- > To UNSUBSCRIBE, email to [EMAIL PROTECTED] > with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED] > -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: ssh ip address
On Tue, Feb 19, 2002 at 05:35:13PM -0300, Eduardo J. Gargiulo wrote: > Hi all. > > Is there any way to obtain the IP address of a ssh client and use it on > a shell script? I want to put a crontab like > > ssh server script > > but I need the IP address i'm connecting from in the shell script and > the address is assigned dynamically. $ man ssh look for SSH_CLIENT (at least in ssh 1.2.3-9.4) -- Karl E. Jørgensen [EMAIL PROTECTED] www.karl.jorgensen.com Today's fortune: The only "intuitive" interface is the nipple. After that, it's all learned. -- Bruce Ediger, [EMAIL PROTECTED], on X interfaces msg05749/pgp0.pgp Description: PGP signature
Re: ssh ip address
Have you taken a look at the environment variables that get set when you log in over SSH? For me I find I have a variable appropriately call'd "SSH_CLIENT" that contains the IP address, local port, and remote port... As simple IP=$(echo ${SSH_CLIENT} | awk '{print $1}') inside your script should get what you want... Jeremy On Tue, Feb 19, 2002 at 05:35:13PM -0300, Eduardo J. Gargiulo wrote: > Hi all. > > Is there any way to obtain the IP address of a ssh client and use it on > a shell script? I want to put a crontab like > > ssh server script > > but I need the IP address i'm connecting from in the shell script and > the address is assigned dynamically. > > thanks > > ~ejg > -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: ssh ip address
## Eduardo J. Gargiulo ([EMAIL PROTECTED]): > Is there any way to obtain the IP address of a ssh client and use it on > a shell script? I want to put a crontab like OpenSSH sets $SSH_CLIENT, containing the client's IP address, the remote and the local port of the connection. Regards, cmt -- Spare Space -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: ssh ip address
Eduardo J. Gargiulo writes: > but I need the IP address i'm connecting from in the shell script and > the address is assigned dynamically. echo $SSH_CLIENT, you'll get ip, remote port and local port. -- Davy Gigan System & Network Administration [Please no HTML, I'm not a browser] University Of Caen (France) [Pas d'HTML, je ne suis pas un navigateur] -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: ssh ip address
"Eduardo J. Gargiulo" <[EMAIL PROTECTED]> writes: > Hi all. > > Is there any way to obtain the IP address of a ssh client and use it on > a shell script? I want to put a crontab like > > ssh server script > > but I need the IP address i'm connecting from in the shell script and > the address is assigned dynamically. echo $SSH_CLIENT | awk '{print $1}' or echo $SSH2_CLIENT | awk '{print $1}' -- /* Dale Southard Jr. [EMAIL PROTECTED] 925-422-1463, fax 422-9429 */ /* Computer Scientist, Accelerated Strategic Computing Initiative */ /* L-073, Lawrence Livermore National Lab, Livermore CA 94551 */ /* AFF/I, SL/I, T/I, D-11216, Sr. Rig --- I'd rather be skydiving */ -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: ssh ip address
Try just doing an `echo $SSH_CLIENT`. Depending on your version, you may need split the output up a bit... --Rich "Eduardo J. Gargiulo" wrote: > > Hi all. > > Is there any way to obtain the IP address of a ssh client and use it on > a shell script? I want to put a crontab like > > ssh server script > > but I need the IP address i'm connecting from in the shell script and > the address is assigned dynamically. > > thanks > > ~ejg -- _ Rich Puhek ETN Systems Inc. _ -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]