1849687 Members
6463 Online
104044 Solutions
New Discussion

I deal port 21

 

I deal port 21

Hello

As I can know the amount of I deal that it originates the port 21 (FTP)
8 REPLIES 8
Robert-Jan Goossens
Honored Contributor

Re: I deal port 21

Hi Carlos,

I'm not sure I understand your question, if you mean

# cat /etc/services | grep ftp

ftp 21/tcp # File Transfer Protocol (Control)

Hope it helps,

Robert-Jan.

Re: I deal port 21


I want to know trafic (in MB) of network that originates ftp's to me
harry d brown jr
Honored Contributor

Re: I deal port 21


In /etc/inetd.conf, change your ftpd line to this:

ftp stream tcp nowait root /usr/lbin/ftpd ftpd -lvLio

THen monitor /var/adm/syslog/xferlog and /var/adm/syslog/syslog.log.

xferlog will have entries like this:

Mon Mar 10 08:09:56 2003 0.368711 vpart2.paychex.com 397282 /tmp/hosts.ugly b _ i r root ftp 0 * 1047301796

where the number 397282 is the number of bytes transmitted.

live free or die
harry
Live Free or Die
Bill Hassell
Honored Contributor

Re: I deal port 21

Not really possible with typical HP-UX tools. ftp does not log actual bytes transferred. To determine the actual commands and/or files that were transferred, edit /etc/inetd.conf and add the -L option (for commands) and -i -o for input/output files respectively. Note that this is for 11.0 and higher with the latest ftp patches.


Bill Hassell, sysadmin

Re: I deal port 21


Thank you very much

And if I want the amount of traffic per day

I must add all the transmissions?

there is some other way!
harry d brown jr
Honored Contributor

Re: I deal port 21

Bill,

With the xferlog turned on, I get this on my ftp's:

# ll
total 7958
drwxrwxrwx 2 root sys 1024 Feb 13 16:15 JUNK
drwx------ 2 root sys 1024 Mar 7 15:55 SAVED
-rw------- 1 root sys 153 Mar 7 15:59 boot.cacheonly
-rw------- 1 root sys 187 Mar 7 15:59 conf.cacheonly
-rw------- 1 root sys 656 Mar 7 15:58 db.10
-rw------- 1 root sys 434 Mar 7 15:59 db.10.2.109
-rw------- 1 root sys 286 Mar 10 07:46 db.127.0.0
-rw------- 1 root sys 199 Mar 7 15:59 db.cache
-rw------- 1 root sys 747 Mar 7 15:59 db.paychex
-rw------- 1 root sys 153 Mar 7 15:59 named.boot
-rw------- 1 root sys 316 Mar 7 15:59 named.conf
-rw------- 1 root sys 3908504 Mar 10 08:27 named.run
-rw------- 1 root sys 0 Mar 9 09:54 named.stats
-rw------- 1 root sys 0 Mar 9 09:54 named_dump.db
# hostname
vpart1
# ftp vpart1
Connected to vpart1.paychex.com.
220 vpart1.paychex.com FTP server (Version 1.1.214.4(PHNE_27765) Wed Sep 4 05:59:34 GMT 2002) ready.
Name (vpart1:root): root
331 Password required for root.
Password:
230 User root logged in.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> cd /tmp
250 CWD command successful.
ftp> put named.run
200 PORT command successful.
150 Opening BINARY mode data connection for named.run.
226 Transfer complete.
3910682 bytes sent in 0.08 seconds (49059.98 Kbytes/s)
ftp> quit
221 Goodbye.
#


Note the bytes sent (3910682), and in the xfer log:

Mon Mar 10 08:29:18 2003 0.084716 vpart1.paychex.com 3910682 /tmp/named.run b _ i r root ftp 0 * 1047302958


live free or die
harry
Live Free or Die
Jose Mosquera
Honored Contributor

Re: I deal port 21

Hi,

If you are on 11.0 or on 10.20 with wu_ftpd implementation you could do this:

1)set the "-a" option into your /etc/inetd.conf
ftp stream tcp nowait root /usr/lbin/ftpd ftpd -l -a
(*)See detailed info with "man ftpd"

2)set your *guest* (guestgroup) and *real* groups into /etc/ftpd/ftpaccess and /etc/group files.

3)Define your log transfers type, i.e:
log transfers anonymous,real,guest inbound,outbound
This definition makes that these ftp's users groups (anonymous,real,guest) and its corresponding inbounds (get) and outbounds (put) are registered in /var/adm/syslog/xferlog file.
(*)See detailed info "man ftpaccess"

4) In this step you must be a detailed ftp log entry for each session, so you only need check your /var/adm/syslog/xferlog to view the inbound/outbound ftp trafic or make a script file to get your customized info.
(*)See detailed info about los structure "man xferlog"

Rgds.
Bill Hassell
Honored Contributor

Re: I deal port 21

Harry is quite correct. The man page simply mentions files and not the details. The xferlog will indeed log each file size too. Note that you will have to create a cron job to read this file, extract just one day's worth of data and add the totals. All of this can be scripted.


Bill Hassell, sysadmin