Press "Enter" to skip to content

Month: 2011年7月

CentOS 5.6 X86_64系统下Vsftpd.conf配置

热度 2,419 度

安装方式可以直接用光盘安装时自带的vsftp或是采用yum,也可以采用源码编译。安装过程就不讲了。直接配置文件
首先操作备份文件及创建一个vsftpd.conf文件

[root@kiccleaf]# adduser leaf
[root@kiccleaf]# passwd leaf
Changing password for user leaf.
New UNIX password: #输入新密码
Retype new UNIX password: #输入重复密码
passwd: all authentication tokens updated successfully.

[root@kiccleaf]# mv /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd.conf.bak
[root@kiccleaf]# vim /etc/vsftpd/vsftpd.conf

vsftpd.conf配置文件内容如下:

anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
listen=YES
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
chroot_list_enable=Yes
userlist_enable=Yes
userlist_deny=No
pasv_enable=YES
pasv_min_port=65000
pasv_max_port=65100
use_localtime=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/user_list

添加leaf用户至user_list文件中,使leaf用户可以登陆ftp

[root@kiccleaf]# echo leaf >> /etc/vsftpd/user_list  #添加leaf用户可以登陆的ftp
[root@kiccleaf]#  service vsftpd restart  #重启vsftpd
Leave a Comment

FreeBSD8.2中用axel提高ports的安装速度

热度 2,489 度

提升ports下载速度实现多线程。

首先到
cd /usr/ports/ftp/axel 之后 make install clean

安装完成后把/etc/make.conf文件编辑如下:

FETCH_CMD=axel
FETCH_BEFORE_ARGS= -n 10 -a
FETCH_AFTER_ARGS=
DISABLE_SIZE=yes

其次添加下载源地址,不用去国外下载

MASTER_SITE_FREEBSD_ORG= ftp://ftp.cn.FreeBSD.org/pub/FreeBSD/%SUBDIR%/
MASTER_SITE_GNOME=  http://mirrors.geekbone.org/gnome/%SUBDIR%/
MASTER_SITE_LOCAL=  ftp://ftp.cn.FreeBSD.org/pub/FreeBSD/ports/local-distfiles/%SUBDIR%/
MASTER_SITE_OVERRIDE=ftp://ftp.cn.freebsd.org/pub/FreeBSD/ports/distfiles/${DIST_SUBDIR}/
Leave a Comment

FreeBSD8.2下vsftp安装配置

热度 2,593 度

由于涉及FTP到解决方案,特别在FreeBSD8.2下采用ports部署vsftp,配置如下:

先创建用户:leaf 密码:123456  采用adduser命令添加此用户,关于添加用户另一章中已经有介绍。

kiccleaf# cd /usr/ports/ftp/vsftpd
kiccleaf# make install clean

可以不用选择
Options for vsftpd 2.3.4 x

===> Compressing manual pages for vsftpd-2.3.4
===> Registering installation for vsftpd-2.3.4
===> SECURITY REPORT:
This port has installed the following files which may act as network
servers and may therefore pose a remote security risk to the system.
/usr/local/libexec/vsftpd

If there are vulnerabilities in these programs there may be a security
risk to the system. FreeBSD makes no guarantee about the security of
ports included in the Ports Collection. Please type 'make deinstall'
to deinstall the port if this is a concern.

For more information, and contact details about the security
status of this software, see the following webpage:
http://vsftpd.beasts.org/
kiccleaf#

防止修改错误先备份vsftpd.conf文件

kiccleaf# mv /usr/local/etc/vsftpd.conf /usr/local/etc/vsftpd.conf.bak
kiccleaf# ee/usr/local/etc/vsftpd.conf

在新建文件vsftpd.conf输入以下代码内容:

anonymous_enable=NO
write_enable=YES
local_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
data_connection_timeout=3
nopriv_user=nobody
listen=YES
secure_chroot_dir=/usr/local/share/vsftpd/empty
chroot_local_user=YES
tcp_wrappers=Yes
userlist_enable=Yes
userlist_deny=No
pasv_enable=Yes
pasv_min_port=65000
pasv_max_port=65100
userlist_file=/usr/local/etc/vsftpd.user_list

创建一个文件,添加可登陆的FTP用户

kiccleaf# echo leaf >> /usr/local/etc/vsftpd.user_list
kiccleaf# cd /usr/local/etc/
kiccleaf# ll
total 32
-rw-r--r--  1 root  wheel  3770 Jul 12 17:39 axelrc
drwxr-xr-x  2 root  wheel   512 Jul 12 17:12 devd
drwxr-xr-x  2 root  wheel   512 Jul 12 17:12 man.d
drwxr-xr-x  2 root  wheel   512 Jul 12 17:12 pam.d
drwxr-xr-x  2 root  wheel   512 Jul 12 18:39 rc.d
-r--r--r--  1 root  wheel  5010 Jul 12 21:22 vsftpd.conf
-r--r--r--  1 root  wheel  4586 Jul 12 21:20 vsftpd.conf.dist
-rw-r--r--  1 root  wheel     1 Jul 12 21:23 vsftpd.user_list
-r--r--r--  1 root  wheel  4499 Jul 12 17:37 wgetrc.sample
kiccleaf# cat /usr/local/etc/vsftpd.user_list
leaf  #刚执行添加的用户leaf
kiccleaf# /usr/local/libexec/vsftpd &
[1] 1952

添加到随系统启动项中

kiccleaf# echo vsftp_ebable=YES >>/etc/rc.conf

回去Win下采用FlashFxp进行链接测试


链接成功后

Leave a Comment

FreeBSD直接可以用命令升级,比如将FreeBSD8.1升级成FreeBSD8.2[原创]

热度 2,724 度

升级FreeBSD系统FreeBSD8.1升级成FreeBSD8.2的操作过程

kiccleaf# uname -a
FreeBSD qm.w 8.1-RELEASE FreeBSD 8.1-RELEASE #0: Fri Feb 18 02:24:46 UTC 2011     root@almeida.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
kiccleaf# freebsd-update -r 8.2-RELEASE upgrade
Looking up update.FreeBSD.org mirrors... 4 mirrors found.
Fetching metadata signature for 8.1-RELEASE from update5.FreeBSD.org... done.
Fetching metadata index... done.
Fetching 1 metadata patches. done.
Applying metadata patches... done.
Fetching 1 metadata files... done.
Inspecting system... done.

The following components of FreeBSD seem to be installed:
kernel/generic world/base

The following components of FreeBSD do not seem to be installed:
src/base src/bin src/cddl src/contrib src/crypto src/etc src/games
src/gnu src/include src/krb5 src/lib src/libexec src/release src/rescue
src/sbin src/secure src/share src/sys src/tools src/ubin src/usbin
world/catpages world/dict world/doc world/games world/info
world/manpages world/proflibs

Does this look reasonable (y/n)? y

Fetching metadata signature for 8.2-RELEASE from update5.FreeBSD.org... done.
Fetching metadata index... done.
Fetching 1 metadata patches. done.
Applying metadata patches... done.
Fetching 1 metadata files... done.
Inspecting system... done.
Fetching files from 8.1-RELEASE for merging... done.
Preparing to download files... done.
Fetching 5591
60....5570....5580....5590 done.
Applying patches... done.
Fetching 47 files... done.
Attempting to automatically merge changes in files... done.
kiccleaf# freebsd-update install
Installing updates...
Kernel updates have been installed.  Please reboot and run
"/usr/sbin/freebsd-update install" again to finish installing updates.

记住以下这两步不可少,否则远程登陆不了就要跑机房咯
第一步:先更新一下ssh

kiccleaf# vi /etc/ssh/sshd_config

Port 22
PermitRootLogin no
PubkeyAuthentication yes
AuthorizedKeysFile    .ssh/id_dsa.pub
PasswordAuthentication no
PermitEmptyPasswords no

第二步:把配置ssh随系统启动

kiccleaf# cat /etc/rc.conf

sshd_enable="YES"

kiccleaf# shutdown -r now
kiccleaf# uname -a
FreeBSD qm.w 8.2-RELEASE FreeBSD 8.2-RELEASE #0: Fri Feb 18 02:24:46 UTC 2011     root@almeida.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
Leave a Comment

修改phpMyAdmin使其能够管理多台远程MySQL服务器[原创]

热度 3,487 度

因为最近采用多数据维护和操作,每个数据库安装一个phpmyadmin不太现实也太繁琐。所以就对phpmyadmin进行修改实现了多mysql数据库管理的方法

经过测试版本:phpMyAdmin 3.3.5-rc1、phpMyAdmin3.4.3.1

修改方法:

第一步:打开/phpmyadmin/libraries 目录

第二步:修改config.default.php 文件(linux下可用vim编辑,FreeBSD下可用vi或是ee编辑)找到“AllowArbitraryServer
代码内容

$cfg['AllowArbitraryServer'] = false;
修改成:
$cfg['AllowArbitraryServer'] = true;

第三步:保存后去浏览器输入地址http://youdomain.com/phpmyadmin/
查看结果:

phpmyadmin登陆界面
phpmyadmin登陆界面
Leave a Comment

FreeBSD 8.2下SSH配置KEY登陆

热度 3,367 度

首先我们找到系统下/etc/ssh/sshd_config 文件并用 ee /etc/ssh/sshd_config 打开内容如下:

# $OpenBSD: sshd_config,v 1.80 2008/07/02 02:24:18 djm Exp $
# $FreeBSD: src/crypto/openssh/sshd_config,v 1.49.2.1.2.1 2009/10/25 01:10:29 kensmith
Exp $
# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options change a
# default value.
# Note that some of FreeBSD's defaults differ from OpenBSD's, and
# FreeBSD has a few additional options.
#VersionAddendum FreeBSD-20090522
Port 222  #可修改端口号,防止攻击,默认为22端口
#Protocol 2
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::
# Disable legacy (protocol version 1) support in the server for new
# installations. In future the default will change to require explicit
# activation of protocol 1
Protocol 2
# HostKey for protocol version 1
#HostKey /etc/ssh/ssh_host_key
# HostKeys for protocol version 2
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key
# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h
#ServerKeyBits 1024
# Logging
# obsoletes QuietMode and FascistLogging
#SyslogFacility AUTH
#LogLevel INFO
# Authentication:
#LoginGraceTime 2m
PermitRootLogin no    #是否允许ROOT用户直接登陆系统 yes  是  no 否
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10
#RSAAuthentication yes
#PubkeyAuthentication yes
AuthorizedKeysFile .ssh/id_dsa.pub  #修改使用用户目录下KEY公共文件
# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#RhostsRSAAuthentication no
# similar for protocol version 2
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes
# Change to yes to enable built-in password authentication.
#修改可以密码进行登陆
PasswordAuthentication no     # 不允许用户使用密码方式登录
PermitEmptyPasswords no       # 禁止空密码的用户进行登录
# Change to no to disable PAM authentication
#ChallengeResponseAuthentication yes
# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no
# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
# Set this to 'no' to disable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
#UsePAM yes
#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS yes
#PidFile /var/run/sshd.pid
#MaxStartups 10
#PermitTunnel no
#ChrootDirectory none
# no default banner path
#Banner none
# override default of no subsystems
Subsystem sftp /usr/libexec/sftp-server
# Example of overriding settings on a per-user basis
#Match User anoncvs
# X11Forwarding no
# AllowTcpForwarding no
# ForceCommand cvs server
OK,以上SSH配置修改完成!进行重启SSH服务,
leaf# /etc/rc.d/sshd restart
Stopping sshd.
Starting sshd.
进入下一步生成Key
leaf# ssh-keygen -t dsa   输入生成语句
Generating public/private dsa key pair.
Enter file in which to save the key (/root/.ssh/id_dsa):  # 默认回车即可,或是选择你要存放的位置
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase):  #输入密匙的密码
Enter same passphrase again:     #再次输入密匙的密码
Your identification has been saved in /root/.ssh/id_dsa.
Your public key has been saved in /root/.ssh/id_dsa.pub.
The key fingerprint is:
11:d6:63:26:84:fc:4f:6d:c3:9a:fa:50:ff:08:f4:0b root@leaf
The key's randomart image is:
+--[ DSA 1024]----+
|     . o+.       |
|      o...=      |
|       ..+ +     |
|        ... =    |
|        Soo+ .   |
|         o+o     |
|        ..E o    |
|        .. o +   |
|         .. o .  |
+-----------------+
leaf# ll /root/  #查看root目录是否生成了.ssh目录
total 16
-rw-r--r--  2 root  wheel   812 Mar  9 06:53 .cshrc
-rw-------  1 root  wheel  2369 Mar 10 07:26 .history
-rw-r--r--  1 root  wheel   155 Nov 21 22:57 .k5login
-rw-r--r--  1 root  wheel   303 Nov 21 22:57 .login
-rw-------  1 root  wheel   332 Feb  4 00:55 .mysql_history
-rw-r--r--  2 root  wheel   265 Nov 21 22:57 .profile
drwx------  2 root  wheel   512 Mar 12 06:37 .ssh
leaf# ll /root/.ssh/  #查看.ssh目录下是否有id_dsa 和id_dsa.pub 两个文件
total 4
-rw-------  1 root  wheel  736 Mar 12 06:37 id_dsa      #确认私钥已经建立
-rw-r--r--  1 root  wheel  603 Mar 12 06:37 id_dsa.pub  #确认公钥已经建立

接下去下载id_dsa 文件,并配置到相应的用户SSH登陆软件中。记住下载完id_dsa文件后,记得删除id_dsa文件!
执行以下操作:
leaf# rm -r id_dsa
Leave a Comment