NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.

Forum Discussion

chinee's avatar
chinee
Follower
Nov 14, 2011

How can i see who is on my ready nas ???

I want to see on any time who is on my nas . how is this possible.??
I hoop that some wan knows how.
:(

4 Replies

Replies have been turned off for this discussion
  • There's no built-in way from Frontview, if that's what you're asking.

    Each protocol will have it's own way of handling it. For example, with SSH access, you can check current status with the command smbstatus:

    Prometheus:/c/media/BitTorrent# smbstatus

    Samba version 3.0.34
    PID Username Group Machine
    -------------------------------------------------------------------
    24161 dbott users omega-xp (192.168.1.193)

    Service pid machine Connected at
    -------------------------------------------------------
    Software 24161 omega-xp Thu Aug 20 22:31:29 2009
    Temp 24161 omega-xp Thu Aug 20 22:31:47 2009
    dbott 24161 omega-xp Wed Aug 19 22:21:37 2009
    media 24161 omega-xp Wed Aug 19 22:21:40 2009
    media 28456 lenovo-sl500 Sat Aug 22 23:10:24 2009

    Locked files:
    Pid Uid DenyMode Access R/W Oplock SharePath Name Time
    --------------------------------------------------------------------------------------------------
    24161 1006 DENY_NONE 0x100001 RDONLY NONE /c/media somefile Aug 22 23:10:24 2009
    24161 1006 DENY_NONE 0x100001 RDONLY NONE /c/media somefile Aug 22 23:10:24 2009
    24161 1006 DENY_NONE 0x100001 RDONLY NONE /c/media somefile Aug 22 23:10:24 2009
    24161 1006 DENY_NONE 0x100001 RDONLY NONE /c/media somefile Aug 22 23:10:24 2009
    24161 1006 DENY_NONE 0x100001 RDONLY NONE /c/media somefile Aug 22 23:10:24 2009


    For FTP you can check the logs:

    cat /var/log/proftpd.log

    May 16 11:20:20 Prometheus proftpd[29864] 192.168.1.20 (192.168.1.30[192.168.1.30]): FTP session opened.
    May 16 15:20:21 Prometheus proftpd[29864] 192.168.1.20 (192.168.1.30[192.168.1.30]): Preparing to chroot to directory '/home/ftp'
    May 16 15:20:21 Prometheus proftpd[29864] 192.168.1.20 (192.168.1.30[192.168.1.30]): USER dbott: Login successful.


    Some of the add-ons (NTOP and NAS-MONITOR) may offer additional connection info as well.
  • I am also interested in this question ... bad that this isn't integrated in the Frontview. I would think that this a basic thing. Isn't it important to check if there are users active on the ready nas (with open files), if you want to switch if off or restart for example?

    I am mainly interessted in AFP (and I'm just planning to buy a Ready NAS the first time; I am now used to work with a OS X Server and RAID connected) – is there also a command which shows users and locked files (by SSH accress)?
  • goodidea wrote:
    I am also interested in this question ... bad that this isn't integrated in the Frontview. I would think that this a basic thing. Isn't it important to check if there are users active on the ready nas (with open files), if you want to switch if off or restart for example?

    I am mainly interessted in AFP (and I'm just planning to buy a Ready NAS the first time; I am now used to work with a OS X Server and RAID connected) – is there also a command which shows users and locked files (by SSH accress)?


    +1 looking for checking AFP user status
  • mdgm-ntgr's avatar
    mdgm-ntgr
    NETGEAR Employee Retired
    Netatalk includes a perl script macusers. The source is included in the GPL: http://www.readynas.com/gpl

    Don't know why but for some reason I can find a macusers script at /usr/bin/macusers but only on my Sparc ReadyNAS. Perhaps it was included in one version of RAIDiator or I found it somewhere and downloaded it.

    Here's the one that I found and I think it works for me, though it may be an old version of the script.

    #!/usr/bin/perl

    use strict;
    use Socket;
    use vars qw($MAC_PROCESS $PS_STR $MATCH_STR $ASIP_PORT_NO $ASIP_PORT $LSOF);

    # Written for linux; may have to be modified for your brand of Unix.

    # Support for FreeBSD added by Joe Clarke <marcus@marcuscom.com>.
    # Support could probably be extended for *BSD, but I do not have Net or
    # OpenBSD machines to test with. Code has also been cleaned up and made
    # to compile under strict.
    #
    # The new lsof call should also be quicker as it does not involve a
    # second pipeline.
    #
    # Support has also been added for 16 character usernames.

    $MAC_PROCESS = "afpd";
    if ($^O eq "freebsd" || $^O eq "openbsd") {
    $PS_STR = "-awwxouser,pid,ppid,start,command";
    $MATCH_STR = '(\w+)\s+(\d+)\s+(\d+)\s+([\d\w:]+)';
    } else {
    $PS_STR = "-ef";
    $MATCH_STR = '\s*(\w+)\s+(\d+)\s+(\d+)\s+\d+\s+([\d\w:]+)';
    }
    $ASIP_PORT = "afpovertcp";
    $ASIP_PORT_NO = 548;

    # Change to 0 if you don't have lsof
    $LSOF = 1;
    my %mac = ();

    if ($^O eq "freebsd") {
    open(SOCKSTAT, "sockstat -4 | grep $MAC_PROCESS | grep -v grep |");

    while (<SOCKSTAT>) {
    next if ($_ !~ /$MAC_PROCESS/);
    $_ =~
    /\S+\s+\S+\s+(\d+)\s+\d+\s+[\w\d]+\s+[\d\.:]+\s+([\d\.]+)/;
    my ($pid, $addr, $host);
    $pid = $1;
    $addr = $2;
    $host = gethostbyaddr(pack('C4', split (/\./, $addr)), AF_INET);
    ($host) = ( $host =~ /(^(\d+\.){3}\d+|[\w\d\-]+)/ );
    $mac{$pid} = $host;
    }
    print
    "PID UID Username Name Logintime Mac\n";
    close(SOCKSTAT);
    } elsif ($LSOF == 1) {
    open(LSOF, "lsof -i :$ASIP_PORT |");

    while (<LSOF>) {
    next if ($_ !~ /$ASIP_PORT/);
    $_ =~ /\w+\s+(\d+).*->([\w\.-]+).*/;
    my ($pid, $host);
    $pid = $1;
    $host = $2;
    ($host) = ( $host =~ /(^(\d+\.){3}\d+|[\w\d\-]+)/ );
    $mac{$pid} = $host;
    }
    print
    "PID UID Username Name Logintime Mac\n";
    close(LSOF);
    } else {
    print
    "PID UID Username Name Logintime\n";
    }

    open(PS, "ps $PS_STR |") || die "Unable to open a pipe to ``ps''";

    while (<PS>) {
    next if ($_ !~ /$MAC_PROCESS/);
    my ($user, $pid, $ppid, $time, $name, $uid, $t);
    $_ =~ /$MATCH_STR/;
    $user = $1;
    $pid = $2;
    $ppid = $3;
    $time = $4;

    if ($ppid != 1) {
    ($t, $t, $uid, $t, $t, $t, $name, $t, $t) = getpwnam($user);
    ($name) = ( $name =~ /(^[^,]+)/ );
    printf "%-8d %-8d %-16s %-20s %-9s %s\n", $pid, $uid, $user,
    $name, $time, $mac{$pid};
    }
    }

    close(PS);
    Mulv-NAS:~# cat /usr/bin/macusers
    #!/usr/bin/perl

    use strict;
    use Socket;
    use vars qw($MAC_PROCESS $PS_STR $MATCH_STR $ASIP_PORT_NO $ASIP_PORT $LSOF);

    # Written for linux; may have to be modified for your brand of Unix.

    # Support for FreeBSD added by Joe Clarke <marcus@marcuscom.com>.
    # Support could probably be extended for *BSD, but I do not have Net or
    # OpenBSD machines to test with. Code has also been cleaned up and made
    # to compile under strict.
    #
    # The new lsof call should also be quicker as it does not involve a
    # second pipeline.
    #
    # Support has also been added for 16 character usernames.

    $MAC_PROCESS = "afpd";
    if ($^O eq "freebsd" || $^O eq "openbsd") {
    $PS_STR = "-awwxouser,pid,ppid,start,command";
    $MATCH_STR = '(\w+)\s+(\d+)\s+(\d+)\s+([\d\w:]+)';
    } else {
    $PS_STR = "-ef";
    $MATCH_STR = '\s*(\w+)\s+(\d+)\s+(\d+)\s+\d+\s+([\d\w:]+)';
    }
    $ASIP_PORT = "afpovertcp";
    $ASIP_PORT_NO = 548;

    # Change to 0 if you don't have lsof
    $LSOF = 1;
    my %mac = ();

    if ($^O eq "freebsd") {
    open(SOCKSTAT, "sockstat -4 | grep $MAC_PROCESS | grep -v grep |");

    while (<SOCKSTAT>) {
    next if ($_ !~ /$MAC_PROCESS/);
    $_ =~
    /\S+\s+\S+\s+(\d+)\s+\d+\s+[\w\d]+\s+[\d\.:]+\s+([\d\.]+)/;
    my ($pid, $addr, $host);
    $pid = $1;
    $addr = $2;
    $host = gethostbyaddr(pack('C4', split (/\./, $addr)), AF_INET);
    ($host) = ( $host =~ /(^(\d+\.){3}\d+|[\w\d\-]+)/ );
    $mac{$pid} = $host;
    }
    print
    "PID UID Username Name Logintime Mac\n";
    close(SOCKSTAT);
    } elsif ($LSOF == 1) {
    open(LSOF, "lsof -i :$ASIP_PORT |");

    while (<LSOF>) {
    next if ($_ !~ /$ASIP_PORT/);
    $_ =~ /\w+\s+(\d+).*->([\w\.-]+).*/;
    my ($pid, $host);
    $pid = $1;
    $host = $2;
    ($host) = ( $host =~ /(^(\d+\.){3}\d+|[\w\d\-]+)/ );
    $mac{$pid} = $host;
    }
    print
    "PID UID Username Name Logintime Mac\n";
    close(LSOF);
    } else {
    print
    "PID UID Username Name Logintime\n";
    }

    open(PS, "ps $PS_STR |") || die "Unable to open a pipe to ``ps''";

    while (<PS>) {
    next if ($_ !~ /$MAC_PROCESS/);
    my ($user, $pid, $ppid, $time, $name, $uid, $t);
    $_ =~ /$MATCH_STR/;
    $user = $1;
    $pid = $2;
    $ppid = $3;
    $time = $4;

    if ($ppid != 1) {
    ($t, $t, $uid, $t, $t, $t, $name, $t, $t) = getpwnam($user);
    ($name) = ( $name =~ /(^[^,]+)/ );
    printf "%-8d %-8d %-16s %-20s %-9s %s\n", $pid, $uid, $user,
    $name, $time, $mac{$pid};
    }
    }

    close(PS);


    You can simply type "macusers" and look at the default output of the command like I did.

    Frank from Netatalk suggests typing this:

    # macusers | grep -v PID | cut -d ' ' -f 1 | while read PID ; do lsof -p $PID | grep REG | grep -v " mem " ; done

    I have tested this on the ReadyNAS and the ReadyNAS is missing at least the lsof command but that should be installable via apt-get, I think.

NETGEAR Academy

Boost your skills with the Netgear Academy - Get trained, certified and stay ahead with the latest Netgear technology! 

Join Us!

ProSupport for Business

Comprehensive support plans for maximum network uptime and business peace of mind.

 

Learn More