Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 15

Linux 操作 系统

网络 文件系统

周炯
上海艾基信 息技术有限 公司

Acegene IT Co. Ltd. 1


内容提 要
• 1 FTP 服务器的安装与设置
• 2 NFS 服务器的安装与设置
• 3 SAMBA

Acegene IT Co. Ltd. 2


1. FTP 服务器的安装
• ftp 软件
– vsftpd
– wu-ftpd 、 proftpd 、 pureftpd 等
• vsftpd 安装
– 如果选择完全安装 Linux ,则系统就默认安装 vsftpd
服务器。
– Linux 添加应用程序
• Redhat: 单击【主菜单】 | 【系统设置】 | 【添加删除应用
程序】菜单项,在出现的【软件包管理】对话框里选中“ FTP
服务器”选项,然后单击【更新】按钮,插入要求的安装光盘
,按照屏幕提示完成安装。
• SUSE: 使用 YaST
– RPM 安装
• 获得 vsftpd-1.1.3-8.i386.rpm 安装包
• # rpm –ivh vsftpd-1.1.3-8.i386.rpm
Acegene IT Co. Ltd. 3
1. FTP 服务器的安装 与设置
•vsftpd 配置文件
– /etc/vsftpd.ftpusers 指定哪些用户
帐号不能访问 FTP 服务器。
– /etc/vsftpd.usr_list 该文件里的用户
帐号在默认情况下也不能访问 FTP 服务
器。
– /etc/vsftpd/vsftpd.conf 定义用户登
录控制、用户权限控制、超时设置、服
务器性能选项、服务器响应消息等 FTP
服务器的配置。
Acegene IT Co. Ltd. 4
1 FTP 服务器的设置
• (1) 用户登录控制
– anonymous.enable=YES ,允许匿名用户登录。
– no_anon_password=YES ,匿名用户登录时不需要输入密码。
– local_enable=YES ,允许本地用户登录。
– deny_email_enable=YES ,可以创建一个文件保存某些匿名电子邮件的黑名单,以防止这些人
使用 Dos 攻击。
• (2) 用户权限控制
– write_enable=YES ,开启全局上传权限。
– anon_upload_enable=YES ,允许匿名用户具有上传权限。
– anon_mkdir_wirte_enable=YES ,允许匿名用户有创建目录的权利。
– chown_username=whoever ,当启用 chown_uploads=YES 时,所指定的属主用户帐号,此
处的 whoever 用合法的用户帐号来代替。
– chroot_list_enable=YES ,用一个列表限定哪些本地用户只能在自己目录下活动。
• (3) 用户连接和超时选项
– idle_session_timeout=600 ,设定默认的空闲超时时间,用户超过这段时间不动作将被服务器
踢出。
– data_connection_timeout=120 ,设定默认的数据连接超时时间。
• (4) 服务器日志和欢迎信息
– dirmessage_enable=YES ,允许为目录配置显示信息,显示每个目录下面的 message_file 文
件的内容。
– ftpd_banner=Welcome to FTP service ,自定义 FTP 用户登录到服务器所看到的欢迎信息。
– xferlog_enable=YES ,启用记录上传 / 下载活动日志功能。
– xferlog_file=/var/log/vsftpd.log ,自定义日志文件的保存路径和文件名,默认是
/var/log/vsftpd.log 。

Acegene IT Co. Ltd. 5


1 FTP 服务器的安装 与设置
•启动 / 重新启动 / 停止 vsftpd 服务
– 启动 vsftpd 服务:
• # /etc/rc.d/init.d/vsftpd start
– 重新启动 vsftpd 服务:
• # /etc/rc.d/init.d/vsftpd restart
– 关闭 vsftpd 服务:
• # /etc/rc.d/init.d/vsftpd stop

Acegene IT Co. Ltd. 6


2 网络文 件系统 NFS 服务器 配置
• Make nfs mountpoint (NFS host):
– mkdir -p /nfs
• Set /etc/exports (NFS host)
/nfs prv1.demo(rw,no_root_squash) prv2.demo(rw,no_root_squash)
• Set /etc/hosts
– 127.0.0.1 localhost.localdomain localhost
– 10.1.1.1 prv1.demo prv1 #public network interface
– 10.1.1.2 prv2.demo prv2 #public network interface
• Configure start unused services(NFS host):
– chkconfig --level 2345 nfs on
• Set the accessrights for the nfs mountpoint (NFS host)
– chmod 777 /nfs
– mount -t ext3 /dev/sdd3 /nfs
– /etc/fstab
• /dev/sdd3 /nfs ext3 defaults 12
• Mount /nfs
• Edited /etc/modules.conf (NFS host)
– options nfs nfs_uncached_io=1
• Reboot

Acegene IT Co. Ltd. 7


2 网络文 件系统 NFS 客户端 配置
• Make the mountpoint (NFS client) :
– mkdir -p /oracle/oradata
• Configure /etc/fstab (NFS client)
share.demo:/nfs /u01/oradata nfs rsize=8192,wsize=8192,timeo=14,soft,nointr,tcp,noac

• Mount the nfs mountpoint (NFS client)


– mount /u01/oradata

Acegene IT Co. Ltd. 8


3 Samba 文件系 统
• samba 是 Windows 系统的网络文件协议
– samba 可以用于与 Windows 系统文件共享
• Linux 中访问 Windows 文件系统
– 配置 /etc/fstab
//[host]/[share] /[dir] smbfs username=[user],password=[pwd] 1 2

• #mount /[dir]
– 直接连接
#mount -t smbfs -o username=[user],password=[pwd] //[host]/[share] /[dir]

Acegene IT Co. Ltd. 9


3 配置 Linux 上的 samba 服务器
• 配置文件 /etc/samba
–smb.conf 主要配置
–smbpasswd 帐户信息

Acegene IT Co. Ltd. 10


3 Samba
• smb.conf 配置信息
– workgroup : 設定網絡群組
– printcap name : Samba 3 預設為 CUPS , CUPS
為 Unix 系統列印服務
– load printers :Samba 啟動時自動載入印表機設定
– printing :  如系統使用 CUPS 可忽略上兩項
– hosts allow : 設定可連線之客戶端 IP 地址範圍
– security : 設為 user ,效果類似一般 MSWindows
檔案共享 ( 非網域架構 )
– password server : 可讓 Samba 用第二台電腦作密
碼認證
– encrypt passwords : 把密碼以加密形式傳送
– local master : 本地主瀏覽
– os level : 系統等級
– preferred master : 主瀏覽優勢
Acegene IT Co. Ltd. 11
3 Samba
•smb.conf 配置信息
[sample]
comment = something share
path = /home/somewhere
browseable = yes
writable = yes
create mask = 0755
valid users = @staff lancelot
public = no
printable = no

Acegene IT Co. Ltd. 12


3 Samba
• 注意事项
– 檔案權限層次
– 使用者名稱對換
– 密碼加密情況
– 網域角色
• 群組證策
• 軟件派發
– 並非盲目替代 MSWindows

Acegene IT Co. Ltd. 13


Q&
A
QUESTIONS
ANSWERS
练习
• 配置 vsftpd
– 启动服务器
– 客户端连接服务器
• 配置 NFS
– 启动服务器
– 客户端连接服务器
• 配置 samba
– 连接 windows 系统共享文件
– /etc/fstab
//[host]/[share] /[dir] smbfs username=[user],password=[pwd] 1 2

Acegene IT Co. Ltd. 15

You might also like