Build FTP server to transfer files. Install and configure Pure-FTPd for it.
[1] Install Pure-FTPd
[root@www ~]#
yum --enablerepo=dag -y install pure-ftpd
# install from DAG
[root@www ~]#
vi /etc/pure-ftpd/pure-ftpd.conf
# line 77: change (no Anonymous)
NoAnonymous
yes
# line 143: change
UnixAuthentication
yes
[root@www ~]#
/etc/rc.d/init.d/pure-ftpd start
Starting proftpd:
[ OK ]
[root@www ~]#
chkconfig pure-ftpd on
Showing posts with label FTP. Show all posts
Showing posts with label FTP. Show all posts
10/24/2010
10/21/2010
FTP Server - ProFTPD
[root@www ~]# yum --enablerepo=dag -y install proftpd # install from DAG
[root@www ~]# vi /etc/proftpd.conf
# line 4: change to your hostname
ServerName "www.server.world"
# line 6: change to your email address
ServerAdmin root@server.world
# add near line 79
# get access log
ExtendedLog /var/log/proftpd/access.log WRITE,READ default
# get auth log
ExtendedLog /var/log/proftpd/auth.log AUTH auth
[root@www ~]# vi /etc/ftpusers
# add users you prohibit to FTP access
test
[root@www ~]# /etc/rc.d/init.d/proftpd start
Starting proftpd: [ OK ]
[root@www ~]# chkconfig proftpd on
[root@www ~]# vi /etc/proftpd.conf
# line 4: change to your hostname
ServerName "www.server.world"
# line 6: change to your email address
ServerAdmin root@server.world
# add near line 79
# get access log
ExtendedLog /var/log/proftpd/access.log WRITE,READ default
# get auth log
ExtendedLog /var/log/proftpd/auth.log AUTH auth
[root@www ~]# vi /etc/ftpusers
# add users you prohibit to FTP access
test
[root@www ~]# /etc/rc.d/init.d/proftpd start
Starting proftpd: [ OK ]
[root@www ~]# chkconfig proftpd on
FTP Server - Vsftpd
[root@www ~]# yum -y install vsftpd
[root@www ~]# vi /etc/vsftpd/vsftpd.conf
# line 12: no anonymous
anonymous_enable=NO
# line 80,81: uncomment (permit ascii mode transfer)
ascii_upload_enable=YES
ascii_download_enable=YES
# line 96: uncomment ( enable chroot list )
chroot_list_enable=YES
# line 98: uncomment ( enable chroot list file )
chroot_list_file=/etc/vsftpd/chroot_list
# line 104: uncomment
ls_recurse_enable=YES
# add at the bottom
# enable chroot
chroot_local_user=YES
# specify root directory ( if don't specify, users' home directory become FTP home directory)
local_root=public_html
# use localtime
use_localtime=YES
[root@www ~]# vi /etc/vsftpd/chroot_list
# add users you allow to move over their home directory
cent
[root@www ~]# /etc/rc.d/init.d/vsftpd start
Starting vsftpd for vsftpd: [ OK ]
[root@www ~]# chkconfig vsftpd on
[root@www ~]# vi /etc/vsftpd/vsftpd.conf
# line 12: no anonymous
anonymous_enable=NO
# line 80,81: uncomment (permit ascii mode transfer)
ascii_upload_enable=YES
ascii_download_enable=YES
# line 96: uncomment ( enable chroot list )
chroot_list_enable=YES
# line 98: uncomment ( enable chroot list file )
chroot_list_file=/etc/vsftpd/chroot_list
# line 104: uncomment
ls_recurse_enable=YES
# add at the bottom
# enable chroot
chroot_local_user=YES
# specify root directory ( if don't specify, users' home directory become FTP home directory)
local_root=public_html
# use localtime
use_localtime=YES
[root@www ~]# vi /etc/vsftpd/chroot_list
# add users you allow to move over their home directory
cent
[root@www ~]# /etc/rc.d/init.d/vsftpd start
Starting vsftpd for vsftpd: [ OK ]
[root@www ~]# chkconfig vsftpd on
10/19/2010
NIS
Build NIS Server in order to share users' accounts in local networks. It's neccessary to install ypserv for NIS. [root@ns ~]# yum -y install ypserv
[root@ns ~]# ypdomainname server-linux.info # set NIS domain
[root@ns ~]# vi /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=yes
HOSTNAME=ns.server-linux.info
GATEWAY=192.168.0.1
# add at the bottom of file
NISDOMAIN=server-linux.info
[root@ns ~]# vi /var/yp/Makefile
# MERGE_PASSWD=true|false
# line 42: change
MERGE_PASSWD=false
#
# MERGE_GROUP=true|false
# line 46: change
MERGE_GROUP=false
#
# line 109: add
all: passwd shadow group hosts rpc services netid protocols
[root@ns ~]# vi /var/yp/securenets
host127.0.0.1
255.255.255.0192.168.0.0
# create a directory for web site automatically when a user is added in the system
[root@ns ~]# mkdir /etc/skel/public_html
[root@ns ~]# chmod 711 /etc/skel/public_html
# create a directory for email automatically when a user is added in the system
[root@ns ~]# mkdir -p /etc/skel/Maildir/cur
[root@ns ~]# mkdir -p /etc/skel/Maildir/new
[root@ns ~]# mkdir -p /etc/skel/Maildir/tmp
[root@ns ~]# chmod -R 700 /etc/skel/Maildir/
[root@ns ~]# /etc/rc.d/init.d/portmap start
Starting portmap: [ OK ]
[root@ns ~]# /etc/rc.d/init.d/ypserv start
Starting YP server services: [ OK ]
[root@ns ~]# /etc/rc.d/init.d/yppasswdd start
Starting YP passwd service: [ OK ]
[root@ns ~]# chkconfig portmap on
[root@ns ~]# chkconfig ypserv on
[root@ns ~]# chkconfig yppasswdd on
[root@ns ~]# useradd cent
[root@ns ~]# passwd cent
Changing password for user cent.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@ns ~]# /usr/lib/yp/ypinit -m# update NIS database
At this point, we have to construct a list of the hosts which will run NIS servers. ns.server-linux.info is in the list of NIS server hosts. Please continue to add the names for the other hosts, one per line. When you are done with the list, type a.
next host to add: ns.server-linux.info
next host to add: # push Ctrl + D keys
The current list of NIS servers looks like this:
ns.server-linux.info
Is this correct? [y/n: y] y# input 'y' and push Enter key
We need a few minutes to build the databases...
Building /var/yp/server-linux.info/ypservers...
Running /var/yp/Makefile...
gmake[1]: Entering directory `/var/yp/server-linux.info'
Updating passwd.byname...
Updating passwd.byuid...
Updating group.byname...
Updating group.bygid...
Updating hosts.byname...
Updating hosts.byaddr...
Updating rpc.byname...
Updating rpc.bynumber...
Updating services.byname...
Updating services.byservicename...
Updating netid.byname...
Updating protocols.bynumber...
Updating protocols.byname...
Updating mail.aliases...
gmake[1]: Leaving directory `/var/yp/server-linux.info'
ns.server-linux.info has been set up as a NIS master server.
Now you can run ypinit -s ns.server-linux.info on all slave server.
# It's neccessary to update NIS database with following way if new user is added again
[root@ns ~]# cd /var/yp
[root@ns yp]# make
After building NIS Server, Configure on clients in order to share users' accounts
[root@www ~]# vi /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=yes
HOSTNAME=www.server-linux.info
GATEWAY=192.168.0.1
# add at the bottom
NISDOMAIN=server-linux.info
[root@www ~]# vi /etc/sysconfig/authconfig
USEWINBINDAUTH=no
USEKERBEROS=no
USESYSNETAUTH=no
FORCESMARTCARD=no
USESMBAUTH=no
USESMARTCARD=no
USELDAPAUTH=no
USELOCAUTHORIZE=no
USEWINBIND=no
USESHADOW=yes
USEDB=no
USEMD5=yes
USEPASSWDQC=no
USELDAP=no
USEHESIOD=no
USECRACKLIB=yes
USENIS=yes# change
[root@www ~]# vi /etc/yp.conf
# Valid entries are
#
# domain NISDOMAIN server HOSTNAME
#Use server HOSTNAME for the domain NISDOMAIN.
#
# domain NISDOMAIN broadcast
#Use broadcast on the local net for domain NISDOMAIN
#
# domain NISDOMAIN slp
#Query local SLP server for ypserver supporting NISDOMAIN
#
# ypserver HOSTNAME
#Use server HOSTNAME for the local domain. The
#IP-address of server must be listed in /etc/hosts.
#
# broadcast
#If no server for the default domain is specified or
#none of them is rechable, try a broadcast call to
#find a server.
#
# add at the bottom
domain server-linux.info server nfs.server-linux.info
[root@www ~]# vi /etc/nsswitch.conf
passwd:files nis# line 33: add
shadow:files nis# add
group:files nis# add
#hosts:db files nisplus nis dns
hosts:files dns nis# add
[root@www ~]# chkconfig ypbind on
[root@www ~]# chkconfig portmap on
[root@www ~]# shutdown -r now
www login: cent# user name on NIS
Password:# password
Last login: Sun Mar 11 22:02:12 on tty1
[cent@www ~]$# just logined
[cent@www ~]$ ypwhich
nfs.server-linux.info
[cent@www ~]$ ypcat passwd
cent:x:500:500::/home/cent:/bin/bash
[cent@www ~]$ yppasswd# change password
Changing NIS account information for cent on nfs.server-linux.info.
Please enter old password:# current password
Changing NIS password for cent on nfs.server-linux.info.
Please enter new password: # new password
Please retype new password:
The NIS password has been changed on nfs.server-linux.info.
[root@ns ~]# ypdomainname server-linux.info # set NIS domain
[root@ns ~]# vi /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=yes
HOSTNAME=ns.server-linux.info
GATEWAY=192.168.0.1
# add at the bottom of file
NISDOMAIN=server-linux.info
[root@ns ~]# vi /var/yp/Makefile
# MERGE_PASSWD=true|false
# line 42: change
MERGE_PASSWD=false
#
# MERGE_GROUP=true|false
# line 46: change
MERGE_GROUP=false
#
# line 109: add
all: passwd shadow group hosts rpc services netid protocols
[root@ns ~]# vi /var/yp/securenets
host127.0.0.1
255.255.255.0192.168.0.0
# create a directory for web site automatically when a user is added in the system
[root@ns ~]# mkdir /etc/skel/public_html
[root@ns ~]# chmod 711 /etc/skel/public_html
# create a directory for email automatically when a user is added in the system
[root@ns ~]# mkdir -p /etc/skel/Maildir/cur
[root@ns ~]# mkdir -p /etc/skel/Maildir/new
[root@ns ~]# mkdir -p /etc/skel/Maildir/tmp
[root@ns ~]# chmod -R 700 /etc/skel/Maildir/
[root@ns ~]# /etc/rc.d/init.d/portmap start
Starting portmap: [ OK ]
[root@ns ~]# /etc/rc.d/init.d/ypserv start
Starting YP server services: [ OK ]
[root@ns ~]# /etc/rc.d/init.d/yppasswdd start
Starting YP passwd service: [ OK ]
[root@ns ~]# chkconfig portmap on
[root@ns ~]# chkconfig ypserv on
[root@ns ~]# chkconfig yppasswdd on
[root@ns ~]# useradd cent
[root@ns ~]# passwd cent
Changing password for user cent.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@ns ~]# /usr/lib/yp/ypinit -m# update NIS database
At this point, we have to construct a list of the hosts which will run NIS servers. ns.server-linux.info is in the list of NIS server hosts. Please continue to add the names for the other hosts, one per line. When you are done with the list, type a
next host to add: ns.server-linux.info
next host to add: # push Ctrl + D keys
The current list of NIS servers looks like this:
ns.server-linux.info
Is this correct? [y/n: y] y# input 'y' and push Enter key
We need a few minutes to build the databases...
Building /var/yp/server-linux.info/ypservers...
Running /var/yp/Makefile...
gmake[1]: Entering directory `/var/yp/server-linux.info'
Updating passwd.byname...
Updating passwd.byuid...
Updating group.byname...
Updating group.bygid...
Updating hosts.byname...
Updating hosts.byaddr...
Updating rpc.byname...
Updating rpc.bynumber...
Updating services.byname...
Updating services.byservicename...
Updating netid.byname...
Updating protocols.bynumber...
Updating protocols.byname...
Updating mail.aliases...
gmake[1]: Leaving directory `/var/yp/server-linux.info'
ns.server-linux.info has been set up as a NIS master server.
Now you can run ypinit -s ns.server-linux.info on all slave server.
# It's neccessary to update NIS database with following way if new user is added again
[root@ns ~]# cd /var/yp
[root@ns yp]# make
After building NIS Server, Configure on clients in order to share users' accounts
[root@www ~]# vi /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=yes
HOSTNAME=www.server-linux.info
GATEWAY=192.168.0.1
# add at the bottom
NISDOMAIN=server-linux.info
[root@www ~]# vi /etc/sysconfig/authconfig
USEWINBINDAUTH=no
USEKERBEROS=no
USESYSNETAUTH=no
FORCESMARTCARD=no
USESMBAUTH=no
USESMARTCARD=no
USELDAPAUTH=no
USELOCAUTHORIZE=no
USEWINBIND=no
USESHADOW=yes
USEDB=no
USEMD5=yes
USEPASSWDQC=no
USELDAP=no
USEHESIOD=no
USECRACKLIB=yes
USENIS=yes# change
[root@www ~]# vi /etc/yp.conf
# Valid entries are
#
# domain NISDOMAIN server HOSTNAME
#Use server HOSTNAME for the domain NISDOMAIN.
#
# domain NISDOMAIN broadcast
#Use broadcast on the local net for domain NISDOMAIN
#
# domain NISDOMAIN slp
#Query local SLP server for ypserver supporting NISDOMAIN
#
# ypserver HOSTNAME
#Use server HOSTNAME for the local domain. The
#IP-address of server must be listed in /etc/hosts.
#
# broadcast
#If no server for the default domain is specified or
#none of them is rechable, try a broadcast call to
#find a server.
#
# add at the bottom
domain server-linux.info server nfs.server-linux.info
[root@www ~]# vi /etc/nsswitch.conf
passwd:files nis# line 33: add
shadow:files nis# add
group:files nis# add
#hosts:db files nisplus nis dns
hosts:files dns nis# add
[root@www ~]# chkconfig ypbind on
[root@www ~]# chkconfig portmap on
[root@www ~]# shutdown -r now
www login: cent# user name on NIS
Password:# password
Last login: Sun Mar 11 22:02:12 on tty1
[cent@www ~]$# just logined
[cent@www ~]$ ypwhich
nfs.server-linux.info
[cent@www ~]$ ypcat passwd
cent:x:500:500::/home/cent:/bin/bash
[cent@www ~]$ yppasswd# change password
Changing NIS account information for cent on nfs.server-linux.info.
Please enter old password:# current password
Changing NIS password for cent on nfs.server-linux.info.
Please enter new password: # new password
Please retype new password:
The NIS password has been changed on nfs.server-linux.info.
10/16/2010
[1] Configuration on the system you want to build NFS server
[root@ns ~]# vi /etc/exports
# add *note
/home 192.168.0.0/24(rw,sync,no_root_squash)
# *note
/home ⇒ shared directory
192.168.0.0/24 ⇒ range of networks NFS permits accesses
rw ⇒ possible to read and write
sync ⇒ synchronize
no_root_squash ⇒ enable root privilege
[root@ns ~]# /etc/rc.d/init.d/portmap start
Starting portmap: [ OK ]
[root@ns ~]# /etc/rc.d/init.d/nfs start
Starting nfs services: [ OK ]
Starting nfs quotas: [ OK ]
Starting nfs daemon: [ OK ]
Starting nfs mountd: [ OK ]
[root@ns ~]# /etc/rc.d/init.d/nfslock start
Starting NFS statd: [ OK ]
[root@ns ~]# chkconfig nfs on
[root@ns ~]# chkconfig nfslock on
[root@ns ~]# chkconfig portmap on
[2] Configuration on NFS clients
[root@www ~]# /etc/rc.d/init.d/portmap start
Starting portmap: [ OK ]
[root@www ~]# /etc/rc.d/init.d/nfslock start
Starting NFS statd: [ OK ]
[root@www ~]# /etc/rc.d/init.d/netfs start
Mounting other filesystems: [ OK ]
[root@www ~]# chkconfig nfslock on
[root@www ~]# chkconfig portmap on
[root@www ~]# chkconfig netfs on
[root@www ~]# mount -t nfs nfs.server-linux.info:/home /home
[root@www ~]# df -m
Filesystem1M-blocksUsedAvailableUse%Mounted on
/dev/hda1504038244038%/
tmpfs25702570%/dev/shm
/dev/hda51008349244%/tmp
/dev/hda350401062372323%/usr
/dev/hda41008020593643%/var
nfs.server-linux.info:/home100794188954861%/home
# home directory on NFS is mounted
[root@www ~]# vi /etc/fstab
# add at the bottom: change home directory this server mounts to the one on NFS
/dev/hda1/ext3defaults1 1
devpts/dev/ptsdevptsgid=5,mode=6200 0
tmpfs/dev/shmtmpfsdefaults0 0
proc/procprocdefaults0 0
sysfs/syssysfsdefaults0 0
/dev/hda5/tmpext3defaults1 2
/dev/hda3/usrext3defaults1 2
/dev/hda4/varext3defaults1 2
/dev/hda2swap swapdefaults 0 0
nfs.server-linux.info:/home/homenfsdefaults1 2
[root@ns ~]# vi /etc/exports
# add *note
/home 192.168.0.0/24(rw,sync,no_root_squash)
# *note
/home ⇒ shared directory
192.168.0.0/24 ⇒ range of networks NFS permits accesses
rw ⇒ possible to read and write
sync ⇒ synchronize
no_root_squash ⇒ enable root privilege
[root@ns ~]# /etc/rc.d/init.d/portmap start
Starting portmap: [ OK ]
[root@ns ~]# /etc/rc.d/init.d/nfs start
Starting nfs services: [ OK ]
Starting nfs quotas: [ OK ]
Starting nfs daemon: [ OK ]
Starting nfs mountd: [ OK ]
[root@ns ~]# /etc/rc.d/init.d/nfslock start
Starting NFS statd: [ OK ]
[root@ns ~]# chkconfig nfs on
[root@ns ~]# chkconfig nfslock on
[root@ns ~]# chkconfig portmap on
[2] Configuration on NFS clients
[root@www ~]# /etc/rc.d/init.d/portmap start
Starting portmap: [ OK ]
[root@www ~]# /etc/rc.d/init.d/nfslock start
Starting NFS statd: [ OK ]
[root@www ~]# /etc/rc.d/init.d/netfs start
Mounting other filesystems: [ OK ]
[root@www ~]# chkconfig nfslock on
[root@www ~]# chkconfig portmap on
[root@www ~]# chkconfig netfs on
[root@www ~]# mount -t nfs nfs.server-linux.info:/home /home
[root@www ~]# df -m
Filesystem1M-blocksUsedAvailableUse%Mounted on
/dev/hda1504038244038%/
tmpfs25702570%/dev/shm
/dev/hda51008349244%/tmp
/dev/hda350401062372323%/usr
/dev/hda41008020593643%/var
nfs.server-linux.info:/home100794188954861%/home
# home directory on NFS is mounted
[root@www ~]# vi /etc/fstab
# add at the bottom: change home directory this server mounts to the one on NFS
/dev/hda1/ext3defaults1 1
devpts/dev/ptsdevptsgid=5,mode=6200 0
tmpfs/dev/shmtmpfsdefaults0 0
proc/procprocdefaults0 0
sysfs/syssysfsdefaults0 0
/dev/hda5/tmpext3defaults1 2
/dev/hda3/usrext3defaults1 2
/dev/hda4/varext3defaults1 2
/dev/hda2swap swapdefaults 0 0
nfs.server-linux.info:/home/homenfsdefaults1 2
8/29/2010
FTP Server
[1] Build FTP server to transfer files. Install and configure vsftpd for it.
[root@www ~]#yum -y install vsftpd
[root@www ~]#vi /etc/vsftpd/vsftpd.conf
anonymous_enable=NO // line 12: no anonymous
ascii_upload_enable=YES // line 79: make valid
ascii_download_enable=YES (permit ascii mode transfer)
chroot_list_enable=YES // line 94: make valid
(enable chroot list)
chroot_list_file=/etc/vsftpd/chroot_list // line 96: make valid
(chroot list file)
ls_recurse_enable=YES // line 102: make valid
chroot_local_user=YES // bottom: enable chroot
local_root=public_html // root directory
use_localtime=YES // use local time
[root@www ~]#vi /etc/vsftpd/chroot_list
fedora // write users you permit
[root@www ~]#/etc/rc.d/init.d/vsftpd start
Starting vsftpd for vsftpd: [ OK ]
[root@www ~]#chkconfig vsftpd on
[2] Add CNAME in DNS for FTP server.
[root@ns ~]#vi /var/named/server-linux.info.lan
ftp IN CNAME linuxbasiccommand.blogspot.com
[root@ns ~]#rndc reload
server reload successful
[root@www ~]#yum -y install vsftpd
[root@www ~]#vi /etc/vsftpd/vsftpd.conf
anonymous_enable=NO // line 12: no anonymous
ascii_upload_enable=YES // line 79: make valid
ascii_download_enable=YES (permit ascii mode transfer)
chroot_list_enable=YES // line 94: make valid
(enable chroot list)
chroot_list_file=/etc/vsftpd/chroot_list // line 96: make valid
(chroot list file)
ls_recurse_enable=YES // line 102: make valid
chroot_local_user=YES // bottom: enable chroot
local_root=public_html // root directory
use_localtime=YES // use local time
[root@www ~]#vi /etc/vsftpd/chroot_list
fedora // write users you permit
[root@www ~]#/etc/rc.d/init.d/vsftpd start
Starting vsftpd for vsftpd: [ OK ]
[root@www ~]#chkconfig vsftpd on
[2] Add CNAME in DNS for FTP server.
[root@ns ~]#vi /var/named/server-linux.info.lan
ftp IN CNAME linuxbasiccommand.blogspot.com
[root@ns ~]#rndc reload
server reload successful
Subscribe to:
Posts (Atom)