首页 > Windows开发 > 详细

windows访问linux共享文件夹

时间:2014-04-07 19:44:11      阅读:803      评论:0      收藏:0      [点我收藏+]

1.windows的网上邻居,是通过smb协议来共享信息的,如果需要给访问linux上的共享目录被windows访问到,需要linux有smb协议

bubuko.com,布布扣
sudo apt-get install samba #安装samba服务
   sudo apt-get install smbfs #安装smbfs服务
bubuko.com,布布扣

2.安装好服务后,启动服务

bubuko.com,布布扣
harvey@harvey:/etc/samba$ service smbd restart 
stop: Rejected send message, 1 matched rules; type="method_call", sender=":1.26" (uid=1000 pid=2707 comm="stop smbd ") interface="com.ubuntu.Upstart0_6.Job" member="Stop" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init ")
start: Rejected send message, 1 matched rules; type="method_call", sender=":1.27" (uid=1000 pid=2701 comm="start smbd ") interface="com.ubuntu.Upstart0_6.Job" member="Start" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init ")
harvey@harvey:/etc/samba$ sudo vim smb.conf
bubuko.com,布布扣

3.在服务器端CTR+R 输入\\IP 地址,发现可以正常连接到共享主机了,但是发现没有共享文件夹。所以现在需要在/etc/samba/smb.conf添加共享目录。

4.首先运行testparm来查看配置的信息

bubuko.com,布布扣
harvey@harvey:~$ testparm #运行testparm 查看配置
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[harveyLinux]"
Processing section "[printers]"
Processing section "[print$]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions #查看服务器所有配置

[global]
    server string = %h server (Samba, Ubuntu)
    map to guest = Bad User
    obey pam restrictions = Yes
    pam password change = Yes
    passwd program = /usr/bin/passwd %u
    passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
    unix password sync = Yes
    syslog = 0
    log file = /var/log/samba/log.%m
    max log size = 1000
    dns proxy = No
    usershare allow guests = Yes
    panic action = /usr/share/samba/panic-action %d
    idmap config * : backend = tdb

[harveyLinux]            #修改默认的文件夹这里是共享的文件夹的名称
    path = /home/harvey             #共享文件夹的路径
    read only = No                   #可读可写
    guest ok = Yes                       #可以通过访客访问

[printers]
    comment = All Printers
    path = /var/spool/samba
    create mask = 0700
    printable = Yes
    print ok = Yes
    browseable = No

[print$]
    comment = Printer Drivers
    path = /var/lib/samba/printers
bubuko.com,布布扣

5.以上红色的部分就是要共享文件需要添加(或者叫更改)的数据内容.

6.为了让window可以操作共享的文件夹,需要修改权限

bubuko.com,布布扣
harvey@harvey:/home$ chmod 777  harvey/ -R
harvey@harvey:/home$ ls -l
total 4
drwxrwxrwx 7 harvey harvey 4096 Apr  7 12:44 harvey
bubuko.com,布布扣

windows访问linux共享文件夹,布布扣,bubuko.com

windows访问linux共享文件夹

原文:http://www.cnblogs.com/zhanghaiyublog/p/3650230.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!