Monday, 30 December 2013

FTP ADMINISTRATION in solaris 11

ftp cmd  & Files:-
/usr/lib/inet/proftpd
     /etc/proftpd.conf
     /etc/ftpusers
     /usr/bin/ftpwho
     /usr/bin/ftpcount
     /usr/bin/ftptop
                    
     /usr/sbin/ftpshut
     /var/log/xferlog
     /var/run/proftpd.pid
     /var/run/proftpd.scoreboard


root@solaris2:/usr/lib/inet# svcadm enable ftp
root@solaris2:/usr/lib/inet# ftp 0
ftp: connect: Connection refused
ftp> bye
root@solaris2:/usr/lib/inet# svcs ftp
STATE          STIME    FMRI
maintenance    14:54:56 svc:/network/ftp:default
root@solaris2:/usr/lib/inet# svcs -d ftp
STATE          STIME    FMRI
online         Dec_27   svc:/network/loopback:default
online         Dec_27   svc:/network/physical:upgrade
online         Dec_27   svc:/network/physical:default
online         Dec_27   svc:/system/name-service/cache:default
online         Dec_27   svc:/network/service:default
online         Dec_27   svc:/system/filesystem/local:default
root@solaris2:/usr/lib/inet# svcadm clear ftp
root@solaris2:/usr/lib/inet# svcs ftp
STATE          STIME    FMRI
maintenance    14:55:26 svc:/network/ftp:default

root@solaris2:~# svcs -xv ftp
svc:/network/ftp:default (FTP server)
 State: maintenance since December 30, 2013 03:06:39 PM UTC
Reason: Start method failed repeatedly, last exited with status 1.
   See: http://support.oracle.com/msg/SMF-8000-KS
   See: man -M /usr/share/man -s 1M proftpd
   See: file://usr/share/doc/proftpd/
   See: /var/svc/log/network-ftp:default.log
Impact: This service is not running.
You have new mail in /var/mail/root
root@solaris2:~# more /var/svc/log/network-ftp:default.log
[ Nov  1 16:58:14 Rereading configuration. ]
[ Dec 30 14:54:56 Enabled. ]
[ Dec 30 14:54:56 Executing start method ("/usr/lib/inet/proftpd"). ]
 - warning: unable to determine IP address of 'solaris2'
 - error: no valid servers configured
 - Fatal: error processing configuration file '/etc/proftpd.conf'
[ Dec 30 14:54:56 Method "start" exited with status 1. ]
[ Dec 30 14:54:56 Executing start method ("/usr/lib/inet/proftpd"). ]

Now i change /etc/hosts file ip & hostname as follows
root@solaris2:~# cat /etc/hosts
#
# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
# Internet host table
#
::1             localhost
127.0.0.1       localhost loghost
10.66.10.108 solaris2

root@solaris2:~# svcs ftp
STATE          STIME    FMRI
maintenance    15:06:39 svc:/network/ftp:default
root@solaris2:~# svcadm clear ftp
root@solaris2:~# svcs ftp
STATE          STIME    FMRI
offline*       15:08:53 svc:/network/ftp:default
root@solaris2:~# svcs ftp
STATE          STIME    FMRI
online         15:08:59 svc:/network/ftp:default

root@solaris2:~# cat /etc/proftpd.conf
ServerName                      "FTP server"
ServerIdent                     off
ServerType                      standalone
DefaultServer                   on
Port                            21
Umask                           022
# To prevent DoS attacks, set the maximum number of child processes
# to 30.  If you need to allow more than 30 concurrent connections
# at once, simply increase this value.  Note that this ONLY works
# in standalone mode, in inetd mode you should use an inetd server
# that allows you to limit maximum number of processes per service
# (such as xinetd).
MaxInstances                    30
# Set the user and group under which the server will run.
#User                           ftp
#Group                          ftp
# Normally, we want files to be overwriteable.
AllowOverwrite          on
# Bar use of SITE CHMOD by default.
<Limit SITE_CHMOD>
  DenyAll
</Limit>
# Make PAM the final authority on what gets authenticated.
AuthOrder mod_auth_pam.c* mod_auth_unix.c
# Use system libraries for user lookups.
PersistentPasswd off
# Root login must be enabled explicitly. It is not permitted by default.
# Allow it only if you know what you are doing.
#RootLogin on
RootLogin on
DisplayConnect          /etc/issue

root@solaris2:~# ftp 10.66.10.108
Connected to 10.66.10.108.
220 ::ffff:10.66.10.108 FTP server ready
Name (10.66.10.108:root): root
331 Password required for root
Password:
530 Login incorrect.
Login failed.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> pwd
530 Please login with USER and PASS

root@solaris2:~# cat /etc/ftpusers
#
# List of users denied access to the FTP server, see ftpusers(4).
#
#root
daemon
bin
sys
adm
lp
uucp
nuucp
dladm
netadm
netcfg
smmsp
gdm
xvm
mysql
openldap
webservd
nobody
noaccess
nobody4
aiuser
unknown
ftp
dhcpserv

root@solaris2:~# ftp 0
Connected to 0.0.0.0.
220 ::ffff:127.0.0.1 FTP server ready
Name (0: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> pwd
257 "/root" is the current directory
ftp> bye
221 Goodbye.

root@solaris2:~# ftpwho
standalone FTP daemon [24541], up for 22 min
no users connected
root@solaris2:~# ftpcount
Master proftpd process 24541:
0 users

C:\Users\chittibabu.miriyala>ftp 10.66.10.108
Connected to 10.66.10.108.
220 ::ffff:10.66.10.108 FTP server ready
User (10.66.10.108:(none)): root
331 Password required for root
Password:
230 User root logged in
ftp>


root@solaris2:~# ftpwho
standalone FTP daemon [24541], up for 23 min
24597 root     [ 0m12s]   0m6s idle
Service class                      -   1 user

root@solaris2:~# ftpcount
Master proftpd process 24541:
Service class                      -   1 user


To create Anonymous user:-
root@solaris2:~# passwd -s ftp
ftp       LK
root@solaris2:~# passwd ftp
WARNING: changing account in reserved uid range: ftp.
New Password:
Re-enter new Password:
passwd: password successfully changed for ftp
root@solaris2:~# passwd -s ftp
ftp       LK
root@solaris2:~# passwd -u ftp
WARNING: changing account in reserved uid range: ftp.
passwd: password information changed for ftp
root@solaris2:~# passwd -s ftp
ftp       PS
root@solaris2:~# ftp 0
Connected to 0.0.0.0.
220 ::ffff:127.0.0.1 FTP server ready
Name (0:root): ftp
331 Password required for ftp
Password:
530 Login incorrect.
Login failed.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> bye
221 Goodbye.

root@solaris2:~# vi /etc/ftpusers
hast ftp user
root@solaris2:~# ftp 0
Connected to 0.0.0.0.
220 ::ffff:127.0.0.1 FTP server ready
Name (0:root): ftp
331 Password required for ftp
Password:
230 User ftp logged in
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> bye
221 Goodbye.

root@solaris2:~# ftpwho
standalone FTP daemon [24541], up for 35 min
24639 ftp      [ 0m57s]  0m53s idle
24649 root     [  0m8s]   0m3s idle
Service class                      -   2 users


For a virtual host that is using a fixed IP address, use the following directive. You may add multiple IP addresses separated by spaces if needed.
<VirtualHost 10.0.0.1>
  ServerName "My virtual FTP server"
</VirtualHost>
To provide anonymous ftp access to your site, use these directives:
# Deny login access
  <Limit LOGIN>
    DenyAll
  </Limit>
  <Anonymous ~ftp>
# Allow anonymous logins
    <Limit LOGIN>
      AllowAll
    </Limit> ....
  </Anonymous>
ftp shutdown:-
The ftpshut command closes down the FTP server at a particular time. If you want to stop serving FTP only, but not stop the daemon (so it can report the
service is not available to clients) then use this procedure. The ftpshut command will block connections and stop the current connection, but not shutdown
the server daemon itself.
root@solaris2:~# ftpshut now
Note:-
time: Shutdown time that is specified by the word now for immediate shutdown, or in one of two formats (+ number or HHMM) for a future shutdown

root@solaris2:~# cat /etc/shutmsg
2013 12 30 15 50 51 0010 0005
going down at %s
root@solaris2:~# svcs ftp
STATE          STIME    FMRI
online         15:08:59 svc:/network/ftp:default
root@solaris2:~# ftp 0
Connected to 0.0.0.0.
500 FTP server shut down (going down at Mon Dec 30 15:50:51 2013) -- please try again later
ftp> bye

to restart ftp:-

root@solaris2:~# ftprestart
/usr/sbin/ftpshut: /etc/shutmsg removed
root@solaris2:~# ftp 0
Connected to 0.0.0.0.
220 ::ffff:127.0.0.1 FTP server ready
Name (0: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>

root@solaris2:~# useradd -m test
80 blocks
root@solaris2:~# passwd test
New Password:
Re-enter new Password:
passwd: password successfully changed for test
root@solaris2:~# logins -x -l test
test            100     staff           10
                        /export/home/test
                        /usr/bin/bash
                        PS 123013 -1 -1 -1
root@solaris2:~# df -h
Filesystem             Size   Used  Available Capacity  Mounted on
rpool/export/home/test
                       9.8G    35K       3.5G     1%    /export/home/test

root@solaris2:~# ftp 0
Connected to 0.0.0.0.
220 ::ffff:127.0.0.1 FTP server ready
Name (0:root): test
331 Password required for test
Password:
230 User test logged in
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> bye
221 Goodbye.

root@solaris2:~# /usr/lib/inet/proftpd -V
Compile-time Settings:
  Version: 1.3.3g (maint)
  Platform: SOLARIS2 (SOLARIS2_11) [unavailable]
  Built: Tue Apr 23 2013 15:59:08 PDT
  Built With:
    configure  'CC=/ws/on11update-tools/SUNWspro/sunstudio12.1/bin/cc' 'CXX=/ws/on11update-tools/SUNWspro/sunstudio12.1/bin/CC' '--prefix=/usr' '--mandir=/usr/share/man' '--bindir=/usr/bin' '--libdir=/usr/lib' '--sbindir=/usr/sbin' 'CFLAGS=-m32 -xO4 -xtarget=ultra2 -xarch=sparcvis -xchip=ultra2 -Qoption cg -xregs=no0x1.3a2c000000000p-1022ppl -W2,-xwrap_int  -xmemalign=8s -mt -I/usr/include/kerberosv5 -DHAVE_KRB5_H=1 -DKRB5_DLLIMP= -DHAVE__GETGRPSBYMEMBER' 'LDFLAGS=-z guidance=nolazyload -z nolazyload -lbsm' 'install_user=ul' 'install_group=gk' '--sysconfdir=/etc' '--localstatedir=/var/run' '--libexecdir=/usr/lib/proftpd' '--enable-ipv6' '--enable-ctrls' '--enable-facl' '--enable-nls' '--enable-dso' '--enable-openssl' '--disable-static' '--with-modules=mod_solaris_audit:mod_solaris_priv' '--with-shared=mod_facl:mod_wrap:mod_tls:mod_auth_gss:mod_gss' '--enable-buffer-size=16384'
  CFLAGS: -m32 -xO4 -xtarget=ultra2 -xarch=sparcvis -xchip=ultra2 -Qoption cg -xregs=no0x1.3a2c000000000p-1022ppl -W2,-xwrap_int  -xmemalign=8s -mt -I/usr/include/kerberosv5 -DHAVE_KRB5_H=1 -DKRB5_DLLIMP= -DHAVE__GETGRPSBYMEMBER
  LDFLAGS: -L$(top_srcdir)/lib -z guidance=nolazyload -z nolazyload -lbsm
  LIBS: -lsendfile -lsec -lintl  -lssl -lcrypto -lssl -lcrypto -lpam -lsupp -lsocket -lnsl -lresolv  -ldl
  Files:
    Configuration File:
      /etc/proftpd.conf
    Pid File:
      /var/run/proftpd.pid
    Scoreboard File:
      /var/run/proftpd.scoreboard
    Header Directory:
      /usr/include/proftpd
    Shared Module Directory:
      /usr/lib/proftpd
  Features:
    - Autoshadow support
    + Controls support
    + curses support
    - Developer support
    + DSO support
    + IPv6 support
    + Largefile support
    - Lastlog support
    - ncurses support
    + NLS support
    + OpenSSL support
    + POSIX ACL support
    + Shadow file support
    + Sendfile support
    + Trace support
  Tunable Options:
    PR_TUNABLE_BUFFER_SIZE = 16384
    PR_TUNABLE_DEFAULT_RCVBUFSZ = 8192
    PR_TUNABLE_DEFAULT_SNDBUFSZ = 8192
    PR_TUNABLE_GLOBBING_MAX_MATCHES = 100000
    PR_TUNABLE_GLOBBING_MAX_RECURSION = 8
    PR_TUNABLE_HASH_TABLE_SIZE = 40
    PR_TUNABLE_NEW_POOL_SIZE = 512
    PR_TUNABLE_SCOREBOARD_BUFFER_SIZE = 80
    PR_TUNABLE_SCOREBOARD_SCRUB_TIMER = 30
    PR_TUNABLE_SELECT_TIMEOUT = 30
    PR_TUNABLE_TIMEOUTIDENT = 10
    PR_TUNABLE_TIMEOUTIDLE = 600
    PR_TUNABLE_TIMEOUTLINGER = 30
    PR_TUNABLE_TIMEOUTLOGIN = 300
    PR_TUNABLE_TIMEOUTNOXFER = 300
    PR_TUNABLE_TIMEOUTSTALLED = 3600
    PR_TUNABLE_XFER_SCOREBOARD_UPDATES = 10

1 comment:

  1. How do we keet proftpd session logs.. how we know that there is a session happened and a session was terminated using proftpd.

    ReplyDelete