fam
[Top] [All Lists]

Problem using fam in linux redhat (monitor.c)

To: fam@xxxxxxxxxxx
Subject: Problem using fam in linux redhat (monitor.c)
From: Martin Wickman <martin@xxxxxxxxxxx>
Date: Thu, 17 Oct 2002 22:35:26 +0200
Sender: fam-bounce@xxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020827
Hi

I have been trying to get fam to work with the monitor.c program from the tutorial. monitor.c compiles just fine (I had to change FAMCONNECTION_GETfd to FAMCONNECTION_GETFD -- typo?).

My problem:

I get 'permission denied' if running as a normal user, or 'address already in use' if running as root.

My system:

* RedHat 8.0 standard (kernel 2.4.18-14)
* I tried variations of settings in /etc/fam.conf
* fam is started through xinet.d
* fam is rpm fam-2.6.8-4
* I have tried running fam in debug mode (-d)
* I tried various ways to configure xinet.d/sgi_fam
* FAMOpen() returns ok, it is the FAMMonitorFile/Directory
  functions that returns <0 for some reason
* Probaly nothing, but I noticed early when running
  'strace fam -d' some odd:
  lstat64("/tmp/.famQ0Lw9w", 0xbfffd660)= -1 ENOENT (No such file)
  unlink("/tmp/.famQ0Lw9w")             = -1 ENOENT (No such file)
  But later unlink() with that file doesnt give 'No such file'

Below is all information that I can figure out. I tried to include all related information, I hope it is not too excessive :-)

$ gcc monitor.c -lfam -o monitor && echo just fine
just fine

$ /usr/sbin/rpcinfo -p
   program vers proto   port
    100000    2   tcp    111  portmapper
    100000    2   udp    111  portmapper
    391002    2   tcp  35546  sgi_fam

$ /usr/sbin/rpcinfo -t localhost sgi_fam
rpcinfo: RPC: Unable to receive; errno = Connection reset by peer
program 391002 version 0 is not available

$ /usr/sbin/rpcinfo -t localhost sgi_fam 2
rpcinfo: RPC: Unable to receive; errno = Connection reset by peer
program 391002 version 2 is not available

$ ./monitor monitor.c
FAMMonitor failed: Permission denied
Nothing monitored.

As root

# ./monitor monitor.c
FAMMonitor failed: Address already in use
Nothing monitored.

ls -l /tmp/.fam_socket
srwx------    1 root     nobody          0 Oct 17 22:30 /tmp/.fam_socket


Running monitor with fam -d -C as root:

# fam -C -d
fam[4454]: log level is LOG_DEBUG
fam[4454]: read /etc/fam.conf line 13: "insecure_compatibility" =
           "false"
fam[4454]: read /etc/fam.conf line 20: "untrusted_user" = "nobody"
fam[4454]: read /etc/fam.conf line 28: "local_only" = "false"
fam[4454]: read /etc/fam.conf line 35: "xtab_verification" = "true"
fam[4454]: Running with -C (insecure_compatibility) command-line option
fam[4454]: running in insecure compatibility mode
fam[4454]: listening for clients on descriptor 3
fam[4454]: client fd 4 is local/untrusted.
fam[4454]: new connection from client 4
fam[4454]: client 4 said: client 4 is sockmeister,
           and wants a unix domain socket
fam[4454]: Setting groups to: (none)
fam[4454]: Setting egid to 0
fam[4454]: Skipping setting euid, because it's already 0
fam[4454]: client sockmeister said uid 0; creating /tmp/.famy1B2PY
fam[4454]: listening for requests for uid 0 on descriptor 5
           (/tmp/.famy1B2PY)
fam[4454]: client fd 6 is local/trusted (socket /tmp/.famy1B2PY, uid 0).
fam[4454]: new connection from client 6
fam[4454]: Shutting down connection
fam[4454]: lost connection from sockmeister
fam[4454]: Shutting down connection
fam[4454]: lost connection from client 6
fam[4454]: exiting after 5 seconds of inactivity


Running monitor with fam -C -d as non-root user gives exactly the same output, except uid is 500 instead of 0


I appreciate your time if you are willing to share any ideas with me, cause I am out of them by now :-)



--- straces below ---

$ strace  -e trace=network ./monitor monitor.c
socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 3
bind(3, {sin_family=AF_INET, sin_port=htons(778), sin_addr=inet_addr("0.0.0.0")}}, 16) = -1 EACCES (Permission denied) connect(3, {sin_family=AF_INET, sin_port=htons(111), sin_addr=inet_addr("127.0.0.1")}}, 16) = 0
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 3
connect(3, {sin_family=AF_INET, sin_port=htons(35546), sin_addr=inet_addr("127.0.0.1")}}, 16) = 0
socket(PF_UNIX, SOCK_STREAM, 0)         = 4
connect(4, {sin_family=AF_UNIX, path="/tmp/.famv24zdG"}, 110) = 0
FAMMonitor failed: Permission denied
Nothing monitored.

# strace -e trace=network ./monitor monitor.c
socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 3
bind(3, {sin_family=AF_INET, sin_port=htons(812), sin_addr=inet_addr("0.0.0.0")}}, 16) = 0 connect(3, {sin_family=AF_INET, sin_port=htons(111), sin_addr=inet_addr("127.0.0.1")}}, 16) = 0
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 3
connect(3, {sin_family=AF_INET, sin_port=htons(35546), sin_addr=inet_addr("127.0.0.1")}}, 16) = 0
socket(PF_UNIX, SOCK_STREAM, 0)         = 4
connect(4, {sin_family=AF_UNIX, path="/tmp/.famFzhgfn"}, 110) = 0
FAMMonitor failed: Address already in use
Nothing monitored.


<Prev in Thread] Current Thread [Next in Thread>