Ubuntu 搭建samba服务详解


Windows访问Linux可通过搭建samba服务,共享目录

过程:

Ubuntu安装sudo apt-get install samba

                 sudo apt-get install smbfs

                 sudo apt-get install smbclient

编辑sudo vi /etc/samba/smb.conf

修改处:

# Change this to the workgroup/NT-domain name your Samba server will part of
   doc charset = UTF-8
   unix charset = UTF-8
   workgroup = WORKGROUP
   netbios name = user_name.wingtech.com

# "security = user" is always a good idea. This will require a Unix account
# in this server for every user accessing the server. See
# /usr/share/doc/samba-doc/htmldocs/Samba3-HOWTO/ServerType.html
# in the samba-doc package for details.
   security = user

默认共享的/home/user_name这个文件夹

如果要共享/home/share添加如下:

    [share]
    comment = this is linux share directory
    path = /home/share
    browseable = yes
    public = yes
    writable = yes

注意要将该目录用户名和组名改为user_name

  sudo chown user_name /home/share

  sudo chgrp  user_name /home/share

建立账号sudo smbpasswd -a user_name

重启下samba服务:sudo service smbd restart

此时可以在windows下访问/home/user_name和/home/share这两个文件夹了

可以尝试net use \\IP * /user:user_name;提示输入密码,输入密码,提示命令成功完成证明可以共享了。

相关内容