SetUp www samba vsftpd Server

# install the www server, samba server, vsftpd server

# open firewall port, 80, 137,138,139,3306 ,20,21

yum install httpd mysql-server php php-devel php-mysql

# config the httpd.conf

vi /etc/httpd/conf/httpd.conf

KeepAlive On

MaxKeepAliveRequests 500

AddLanguage zh-TW .zh-tw

AddCharset Big5 .Big5 .big5

# edit Priority zh-TW in to first

LanguagePriority zh-TW en ca ….(….)…. sv zh-CN

# httpd root can browse

Options Indexes FollowSymLinks <==please delete the Indexes

AllowOverride None

Order allow,deny

Allow from all

# edit the /etc/php.ini

register_globals = Off

log_errors = On

ignore_repeated_errors = On

ignore_repeated_source = On

display_errors = Off

display_startup_errors = Off

# start httpd service

service httpd start

# change the port 89 when get this error

[root@wo conf]# vi httpd.conf

[root@wo conf]# service httpd restart

Stopping httpd: [ OK ]

Starting httpd: (13)Permission denied: make_sock: could not bind to address [::]:89

(13)Permission denied: make_sock: could not bind to address 0.0.0.0:89

no listening sockets available, shutting down

Unable to open logs

[root@wo conf]# semanage port -a -t http_port_t -p tcp 89

[root@wo conf]# service httpd restart

Stopping httpd: [FAILED]

Starting httpd: [ OK ]

service mysqld start

# login root in mysql

mysql -u root

quit

mysqladmin -u root password ‘your.password’

Enter password:

mysql -u root -p

mysql> create database dmtsai;

Query OK, 1 row affected (0.01 sec)

#insert user and grant private

insert into user (Host, User, Password) values(‘%’,’wo’,PASSWORD(‘1111’));

insert into user (Host, User, Password) values(‘%’,’upload’,PASSWORD(‘MhevvdRyu7RNr9QZ’));

grant select,insert,update on uploadfile.* to upload@localhost to upload@localhost identified by ‘MhevvdRyu7RNr9QZ’;

grant all privileges on *.* to wo@localhost identified by ‘1111’;

#upload grant

flush privileges;

# dmtsai@localhost <– dmtsai@localhost is user database.table=dmtsai.*

mysql> grant all privileges on dmtsai.* to dmtsai@localhost

identified by ‘your.password’ ;

Query OK, 0 rows affected (0.00 sec)

mysql> show databases;

+———-+

| Database |

+———-+

| dmtsai |

| mysql |

| test |

+———-+

3 rows in set (0.00 sec)

mysql> exit

# edit mysql config

[root@linux ~]# vi /etc/my.cnf

[mysqld]

default-storage-engine=innodb

datadir = /var/lib/mysql

socket = /var/lib/mysql/mysql.sock

default-character-set = utf8

port = 3306

skip-locking

key_buffer = 128M

sort_buffer_size = 2M

read_buffer_size = 2M

join_buffer_size = 2M

max_connections = 150

max_connect_errors = 10

read_rnd_buffer_size = 4M

max_allowed_packet = 4M

table_cache = 1024

myisam_sort_buffer_size = 32M

thread_cache = 16

query_cache_size = 16M

tmp_table_size = 64M

wait_timeout = 1200

thread_concurrency = 8

old_passwords=1

innodb_data_file_path = ibdata1:10M:autoextend

innodb_buffer_pool_size = 128M

innodb_additional_mem_pool_size = 32M

innodb_thread_concurrency = 16

[mysql.server]

user=mysql

basedir=/var/lib

[mysqld_safe]

err-log=/var/log/mysqld.log

pid-file=/var/run/mysqld/mysqld.pid

# install samba

Installing Samba (using yum on CentOS and Fedora): yum install samba

Installing Samba (using rpm):

1.Obtain Samba rpm from rhn.redhat.com

2.rpm -ivh samba*.rpm

# edit samba /etc/samba/smb.conf

[global]

workgroup = vbirdhouse

netbios name = vbirdserver

server string = This is vbird’s samba server

unix charset = utf8

display charset = utf8

dos charset = cp950

log file = /var/log/samba/%m.log

max log size = 50

socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192

dns proxy = no

template shell = /bin/false

winbind use default domain = no

# user is login user, share is public user=no login

security = user

encrypt passwords = yes

smb passwd file = /etc/samba/smbpasswd

# NetBIOS name setting

name resolve order = lmhosts bcast host

[homes]

comment = Home directories

browseable = no

writable = yes

valid users = %S

create mode = 0664

directory mode = 0775

[public]

comment = the user groups work directory

path = /home/public

public = yes

writable = yes

valid users = @users

[temp]

comment = Temporary file space

path = /tmp

read only = no

public = yes

# know the share file setting command

testparm

# know the user wo have what file share

smbclient -L \127.0.0.1 -U wo

# know the public user have what file share

smbclient -L \127.0.0.1

# create user and create smb user

useradd -m test

passwd test

smbpassed -a test

# change ,disable, enable and delete user

smbpasswd test

smbpasswd -d test

smbpasswd -e test

smbpasswd -x test

#start smb service

service smb start

#install vsftpd server

yum install vsftpd

# You may override where the log file goes if you like. The default is shown

# below.

xferlog_file=/var/log/vsftpd.log

#

# If you want, you can have your log file in standard ftpd xferlog format.

# Note that the default log file location is /var/log/xferlog in this case.

xferlog_std_format=YES

# ASCII mangling is a horrible feature of the protocol.

ascii_upload_enable=YES

ascii_download_enable=YES

# You may specify an explicit list of local users to chroot() to their home

# directory. If chroot_local_user is YES, then this list becomes a list of

# users to NOT chroot().

chroot_local_user=YES

chroot_list_enable=YES

# (default follows)

chroot_list_file=/etc/vsftpd/chroot_list

# guest

useradd -s /bin/false -d /home/vsftpdguest vsftpdguest

guest_enable=YES

guest_username=vsftpdguest

pam_service_name=vsftpd

#userlist_deny=YES, new user can login FTP, userlist_deny=NO new user can not log FTP

userlist_enable=YES

userlist_deny=YES

userlist_file=/etc/vsftpd/user_list

use_localtime=YES

tcp_wrappers=YES

banner_file=/etc/vsftpd/welcome.txt

#data_connection_timeout=60

connect_timeout=60

accept_timeout=60

idle_session_timeout=600

#max_clients=10

max_per_ip=10

user_config_dir=/etc/vsftpd/vsftpd_user_conf

# make user root dir

mkdir vsftpd_user_conf

vi vsftpd_user_conf/user

#add to user

anon_world_readable_only=NO

write_enable=YES

anon_upload_enable=YES

local_root=/var/www/html

#start vsftpd service

service vsftpd start