Sponsored Content
Top Forums Programming Fetch "my" IP address in HPUX 10.20 Post 8010 by Perderabo on Thursday 4th of October 2001 03:22:40 PM
Old 10-04-2001
Um, ttys do not have ip addresses.

I think you want the foreign address where the connection originated from? That's hard. The information is in another process. You would need root authority to poke around in /dev/kmem for the answer. The freeware program lsof can do this. You can build a tool around that. HP-UX makes an attempt to record this in utmp. Another possibility is to build something around "who -R am i" (hp-ux specific).

Either way I see a shell script around lsof or who that outputs the ip address. Then you would invoke the script via popen(3) to read the result.
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

2. Infrastructure Monitoring

HPUX net-SNMP interpreter "/bin/perl" not found

I am trying to install net-snmp on an HPUX box. I am getting the fallowing error message when I try to run the snmpconf file. I installed the fallowing version of net-snmp net-snmp-5.0.10.2-HP-UX_B.11.11_9000_800.tar and my HPUX box is version HP-UX commnms B.11.11 U 9000/800... (2 Replies)
Discussion started by: krisarmstrong
2 Replies

3. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

4. Programming

php stop "internal row pointer" when fetch from mysql

Hi gurus, I need to call php function for fetching data from mysql but I dont want to move internal row pointer (IRP) forward. Or even get the actual IRP position then fetch data and move IRP back to remembered position. Function mysql_data_seek() is not suitable for my example because I am trying... (1 Reply)
Discussion started by: wakatana
1 Replies

5. HP-UX

mk_kernel : "dev_config" error (hpux 11.23)

Any clue why I'm getting the error below? I would greatly appreciate any help. HP ITRC is already engaged since this morning but until now I haven't got any resolution. I'm wondering if anybody out there got an idea on how to fix this. Thanks in advance. This is my system: HPUX11i-OE-Ent... (2 Replies)
Discussion started by: msgameng
2 Replies

6. Shell Programming and Scripting

HPUX "bdf" , "%" align to right side.

Hi All, Need you help. I have HPUX “bdf” output, I need % to be align to right side. if you see there are long file systems lv so i cant do column formatting. Any idea or best way to align the "%" to be right side. /dev/emcvg02/lv01 52428800 29931 49123947 0% /abc/disco/iasbin... (7 Replies)
Discussion started by: ashanabey
7 Replies

7. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

8. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

9. AIX

Apache 2.4 directory cannot display "Last modified" "Size" "Description"

Hi 2 all, i have had AIX 7.2 :/# /usr/IBMAHS/bin/apachectl -v Server version: Apache/2.4.12 (Unix) Server built: May 25 2015 04:58:27 :/#:/# /usr/IBMAHS/bin/apachectl -M Loaded Modules: core_module (static) so_module (static) http_module (static) mpm_worker_module (static) ... (3 Replies)
Discussion started by: penchev
3 Replies
acucntrl(8)						      System Manager's Manual						       acucntrl(8)

NAME
acucntrl - turn around tty line between dialin and dialout SYNOPSIS
/usr/libexec/acucntrl keyword ttyline DESCRIPTION
Acucntrl turns around terminal line, enabling it to be used for both dialin and dialout. On dialin a terminal line is assumed to have modem control enabled and a getty process in existence waiting for logins. On dialout modem control is disabled and there is no getty process. This program must be run setuid to root. keyword is chosen from the list: disable or dialout, to condition a line for dialout; and enable or dialin, to condition a line for dialin. When the line is conditioned for dialing out, the login name of the real uid of the process is placed in /var/run/utmp in capitals. This declares that the line is in use and acts as an additional locking mechanism. Acucntrl will refuse to act if the /var/run/utmp entry for the line is not null, is not the the user's login name (capitalized or not), and if the process is not running as the superuser. The last condition is to allow the superuser to clear the state of the line. Turning modem control on or off is handled by poking into /dev/kmem. It is currently implemented for dz, dh, and dmf lines. Under 4.2 BSD the program will also refuse to disable a line if carrier is sensed on it. This is to avoid the dead period where someone has just dialed in and made the connection but has not yet logged in. Ttyline can be either of the form tty* or /dev/tty*. Enabling/disabling a line whose name does not begin with ttyd? is prohibited unless the real uid of the process is 0 or if the login name corresponding to the real uid is uucp. This is a security precaution. Steps taken when disabling (i.e. setup for dialing out) 1) check input arguments 2) look in /var/run/utmp to check that the line is not in use by another user 3) disable modem control on line 4) check for carrier on device 5) change owner of device to real uid 6) edit /etc/ttys, changing the first character of the appropriate line to 0 7) send a hangup to process 1 to poke init to disable getty 8) post uid name in capitals in /var/run/utmp to let world know device has been grabbed 9) make sure that DTR is on Steps taken when enabling (i.e. setup for dialin) 1) check input arguments 2) look in /var/run/utmp to check that the line is not in use by another user 3) make sure modem control on line is disabled 4) turn off DTR to make sure line is hung up 5) condition line: clear exclusive use and set hangup on close modes 6) turn on modem control 7) edit /etc/ttys, changing the first character of the appropriate line to 1 8) send a hangup to process 1 to poke init to enable getty 9) clear uid name for /var/run/utmp HISTORY
First written by Allan Wilkes (fisher!allan) Modified June 8,1983 by W.Sebok (astrovax!wls) to poke the kernel rather than use a kernel hack to turn on/off modem control, using a sub- routine stolen from a program written by Tsutomu Shimomura {astrovax,escher}!tsutomu Worked over many times by W.Sebok (i.e. hacked to death) FILES
/dev/kmem, /vmunix, /etc/ttys, /var/run/utmp, /dev/tty* BUGS
Sensing carrier requires the 4.2 BSD TIOCMGET ioctl call. Unfortunately this ioctl is not implemented in the vanilla 4.2 BSD dh driver even though the dz and dmf drivers use an emulation of the DH11's modem control bits. This has been fixed here. Some time (currently 2 seconds) is required between disabling modem control and opening the device. This is probably because of a race with getty whose open is finally being allowed to complete. This time interval may not be enough on a loaded system. Because of this problem and the above problem with the dh driver there is deliberately no error message given when the TIOCMGET ioctl fails. Previously there was similar synchronization problem with the init process. When dialins are disabled the capitalized name of the process cannot be posted into /var/run/utmp until init has finished clearing /var/run/utmp. However one does not know how long that will take, and, on a loaded system, it can take quite a while. This was solved by the strategy of 1) posting the name, 2) poking init, 3) going into a loop where the process repeatedly waits a second and checks whether the entry has been cleared from /var/run/utmp, and 4) posting the name again. 4.3 Berkeley Distribution November 27, 1996 acucntrl(8)
All times are GMT -4. The time now is 06:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy