首先配置本地yum源,需要在本机拥有操作系统的iso安装文件,以下以Oracle linux为例
# cd /etc/yum.repos.d
--将其他repo文件重命名
# ls
public-yum-el5.repo.1 public-yum-el5.repo.2 public-yum-el5.repo.bk
--创建新repo文件,Server文件夹为rpm软件包的路径
# vi local_yum_el5.repo
[oelr5u8]
name=oelr5u8
baseurl=file:///mnt/Server
gpgcheck=0
enabled=1
# yum clean all
# yum list
# yum install oracle-validated
[root@rh56 dev]# yum install samba
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
oelr5u8 | 1.1 kB 00:00
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package samba.x86_64 0:3.0.33-3.37.el5 set to be updated
--> Processing Dependency: samba-common = 3.0.33-3.37.el5 for package: samba
--> Processing Dependency: perl(Convert::ASN1) for package: samba
--> Running transaction check
---> Package perl-Convert-ASN1.noarch 0:0.20-1.1 set to be updated
---> Package samba-common.x86_64 0:3.0.33-3.37.el5 set to be updated
--> Processing Dependency: libsmbclient = 3.0.33-3.37.el5 for package: samba-common
--> Running transaction check
---> Package libsmbclient.i386 0:3.0.33-3.37.el5 set to be updated
---> Package libsmbclient.x86_64 0:3.0.33-3.37.el5 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
Package Arch Version Repository Size
Installing:
samba x86_64 3.0.33-3.37.el5 oelr5u8 16 M
Installing for dependencies:
perl-Convert-ASN1 noarch 0.20-1.1 oelr5u8 42 k
samba-common x86_64 3.0.33-3.37.el5 oelr5u8 6.8 M
Updating for dependencies:
libsmbclient i386 3.0.33-3.37.el5 oelr5u8 908 k
libsmbclient x86_64 3.0.33-3.37.el5 oelr5u8 917 k
Transaction Summary
Install 3 Package(s)
Upgrade 2 Package(s)
Total download size: 25 M
Is this ok [y/N]: y
Downloading Packages:
Total 643 MB/s | 25 MB 00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Updating : libsmbclient 1/7
Installing : samba-common 2/7
Updating : libsmbclient 3/7
Installing : perl-Convert-ASN1 4/7
Installing : samba 5/7
Cleanup : libsmbclient 6/7
Cleanup : libsmbclient 7/7
Installed:
samba.x86_64 0:3.0.33-3.37.el5
Dependency Installed:
perl-Convert-ASN1.noarch 0:0.20-1.1 samba-common.x86_64 0:3.0.33-3.37.el5
Dependency Updated:
libsmbclient.i386 0:3.0.33-3.37.el5 libsmbclient.x86_64 0:3.0.33-3.37.el5
Complete!
然后配置samba服务
[global]
workgroup = LinuxSir
netbios name = LinuxSir05
server string = Linux Samba Server TestServer
security = share
[Youthsoft]
path = /u01/test01
writeable = yes
browseable = yes
guest ok = yes
创建linux下的共享目录/u01/test01
[root@rh56 samba]# mkdir /u01/test01
要确保远程用户拥有全部的权限,需要在linux操作系统下拥有nobody用户
[root@rh56 samba]# chown -R nobody:nobody /u01/test01
[root@rh56 samba]# id -a nobody
uid=99(nobody) gid=99(nobody) groups=99(nobody)
[root@rh56 samba]# smbd
[root@rh56 samba]# nmbd
[root@rh56 samba]# ls /u01/test01
重启服务
[root@rh56 samba]# service smb restart
Shutting down SMB services: [ OK ]
Shutting down NMB services: [ OK ]
Starting SMB services: [ OK ]
Starting NMB services: [ OK ]
然后在windows下输入网络地址即可看到相应的共享目录
例如本例中ip地址为192.168.1.54
则在windows下运行
\\192.168.1.54
即可看到已经共享的目录 ,并且拥有全部的权限操作这个目录
进阶设定--设置权限
smb.conf 添加配置
[file1]
path = /u01
read only = no
public = no
valid users = @Oracle
write list = oracle
添加smb用户,用户名为oracle
pdbedit -a -u oracle
为smb用户设置密码
smbpasswd oracle
接下来使用
\\192.168.100.54\file1
将会要求输入密码,输入刚才创建的smb用户oracle以及相应的密码即可进入linux共享的文件夹下面。
Windows下写入的文件属性以操作系统上的oracle用户默认属性为准。