最近在CentOs下搞J2ee开发,需要把项目同步到服务器,而又在Windows下开发,所以搞一个samba服务
参考http://www.blogjava.net/yuanqixun/articles/349819.html的讲解自己安装了Samba服务:
- 使用yum安装
[root@localhost ~]# yum install samba
会看到:
Loaded plugins: fastestmirror
Determining fastest mirrors
* base: centos.ustc.edu.cn
* extras: centos.ustc.edu.cn
* updates: centos.ustc.edu.cn
base | 1.1 kB 00:00
euca | 951 B 00:00
extras | 2.1 kB 00:00
updates | 1.9 kB 00:00
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package samba.i386 0:3.0.33-3.29.el5_6.2 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
samba i386 3.0.33-3.29.el5_6.2 updates 16 M
Transaction Summary
================================================================================
Install 1 Package(s)
Upgrade 0 Package(s)
Total download size: 16 M
Is this ok [y/N]: y (这里输入y确认)
Downloading Packages:
samba-3.0.33-3.29.el5_6.2.i386.rpm | 16 MB 00:53
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : samba 1/1
Installed:
samba.i386 0:3.0.33-3.29.el5_6.2
Complete!
- 查看samba安装在了哪里
- [root@localhost ~]# whereis samba
samba: /etc/samba /usr/lib/samba /usr/share/samba /usr/share/man/man7/samba.7.gz
- 配置/etc/samba/smb.conf
- [root@localhost ~]# gedit /etc/samba/smb.conf
- 修改添加信息:
- workgroup = MYGROUP [已有]
server string = Samba Server Version %v [已有]
hosts allow = 127. 192.168.3. 192.168.4. [添加你允许访问的IP范围如127. 192.168.3. 都为网络号,注意最后一个点后有一个空格]
- [share]
comment=Share
path=/usr/local/tomcat7.0/webapps [共享目录]
writable=yes
public=yes - 配置的共享目录设置权限
# mkdir /var/samba/share 如刚才配置的共享目录不存在则创建
# chown -R nobody. /var/samba/share 设置共享目录归属为 nobody
# chmod 777 /var/samba/share 将共享目录属性设置为 777
- 添加samba用户(可以不用加新的用户,如果只是自己用的话)
[root@localhost ~]# smbpasswd -a root
New SMB password:
Retype new SMB password:
Added user root.
[root@localhost ~]# service smb restart
OK了,在Windows里运行键入"\\yourid"登录就可以使用了!!!
注:添加的用户必须在linux下存在才行;