Skip to main content
 Web开发网 » 操作系统 » linux系统

怎样实现Linux局域网内Ubuntu与WinXP共享文档?

2021年10月14日5520百度已收录

  Samba是在Unix系统中用于共享文件和打印机的应用软件。Smbfs is a filesystem which understands the SMB/CIFS protocol。 This is the protocol Windows for Workgroups, Windows NT or LAN Manager use to talk to each other。

   It was inspired by samba, the program by Andrew Tridgell that turns any unix site into a file server for DOS or Windows lients。

或者执行命令行:

#sudo apt-get install samba

#sudo apt-get install smbfs

安装完毕,从菜单进入 系统 -> 系统管理 -> 共享的文件夹

添加准备共享的文件夹。

1。 XP匿名访问Ubuntu共享文件

使用samba不进行任何设置时,winXP机器可以连接到Ubuntu机器但提示输入用户名密码,此时不论输入什么都不能访问,要实现匿名访问需要做如下设置:

1) 修改配置文件smb。

  conf:

sudo vim /etc/samba/smb。conf

将security=user那一行前的注释符";"去掉,然后把user改为share。

2) 重启samba:

#sudo /etc/init。d/samba restart

2。

   WinXP下用用户名和密码访问Ubuntu共享文件

下面我们来共享群组可读写文件夹,假设你要共享的文件夹为: /home/ray/share首先创建这个文件夹

代码:

#mkdir /home/ray/share

#chmod 777 /home/ray/share

备份并编辑smb。

  conf允许网络用户访问

代码:

sudo cp /etc/samba/smb。conf /etc/samba/smb。conf_backup

sudo gedit /etc/samba/smb。conf

搜寻这一行文字

代码:

; security = user

用下面这几行取代

代码:

security = user

username map = /etc/samba/smbusers

将下列几行代码添加到文件的最后面,假设允许访问的用户为:newsfan。

  而文件夹的共享名为 Share

代码:

[Share]

comment = Shared Folder with username and password

path = /home/ray/share

public = yes

writable = yes

valid users = newsfan

create mask = 0700

directory mask = 0700

force user = nobody

force group = nogroup

available = yes

browseable = yes

然后顺便把这里改一下,找到[global]把 workgroup = MSHOME 改成

代码:

workgroup = WORKGROUP

display charset = UTF-8

unix charset = UTF-8

dos charset = cp936

后面的三行是为了防止出现中文目录乱码的情况。

  其中根据你的local,UTF-8 有可能需要改成 cp936。自己看着办吧。现在要添加newsfan这个网络访问帐户。如果系统中当前没有这个帐户,那么

代码:

sudo useradd newsfan

要注意,上面只是增加了newsfan这个用户,却没有给用户赋予本机登录密码。

  所以这个用户将只能从远程访问,不能从本机登录。而且samba的登录密码可以和本机登录密码不一样。现在要新增网络使用者的帐号:

代码:

#sudo smbpasswd -a newsfan

#sudo gedit /etc/samba/smbusers

在新建立的文件内加入下面这一行并保存

代码:

newsfan = “network username”

如果将来需要更改newsfan的网络访问密码,也用这个命令更改

代码:

#sudo smbpasswd -a newsfan

删除网络使用者的帐号的命令把上面的 -a 改成 -x

代码:

#sudo testparm

#sudo /etc/init。

  d/samba restart。

评论列表暂无评论
发表评论
微信