快速配置 Samba 将 Linux 目录映射为 Windows 驱动器

简介: 原文链接 samba client ubuntu redhat ubuntu gui tools  1,列出某个IP地址所提供的共享文件夹 smbclient -L 198.168.0.1   2,在security=share模式下访问一个匿名可以访问的目录 smbclient //192.
+关注继续查看

原文链接

samba client

ubuntu

redhat

ubuntu gui tools


 1,列出某个IP地址所提供的共享文件夹 
smbclient -L 198.168.0.1

 
2,在security=share模式下访问一个匿名可以访问的目录
smbclient //192.168.0.1/目录名

3,像FTP客户端一样使用smbclient 
smbclient //192.168.0.1/tmp  -U username%password 

4,例,创建一个共享文件夹 
smbclient -c "mkdir share1"  //192.168.0.1/tmp  -U username%password 
如果用户共享//192.168.0.1/tmp的方式是只读的,会提示 
NT_STATUS_ACCESS_DENIED making remote directory \share1 
5,除了使用smbclient,还可以通过mount和smbcount挂载远程共享文件夹 
mount -t smbfs -o  username=administrator,password=123456 //192.168.0.1/tmp  /mnt/tmp 
# mount -t smbfs -o username="administrator",password="" //192.168.1.100/cp /mnt/ntfs

提示出错:
mount: unknown filesystem type 'smbfs'

查资料后,说smbfs改为cifs了,所以要用下面的方法:

# mount -t cifs -o username="administrator",password="" //192.168.1.101/cp /mnt/ntfs

成功!!


smbmount //192.168.0.1/tmp /mnt/tmp -o username=administrator

访问目录:


 

ubuntu

一. Samba的安装:

# sudo apt-get insall samba

# sudo apt-get install smbfs

二. 创建共享目录:

# mkdir /home/willis/share

# sodu chmod 777 /home/willis/share

三. 创建Samba配置文件:

1. 保存现有的配置文件

# sudo mv /etc/samba/smb.conf /etc/samba/smb.conf.bak

2. 创建新的Samba配置文件

# sodu vim /etc/samba/smb.conf

; ############### smb.conf #######################

[global]

    ; 创建工作组   

    workgroup = MYGROUP

    ; 安全模式, 我们设置最低安全级别

    security = share

    ; 是否允许guest用户访问

    guest ōk = yes

[share]

    ; 共享文件夹路径

    path = /home/willis/share

    ; 读权限

    browseable = yes

    ; 写权限

    writeable = yes

四. 测试文件配置结果

# testparm

五. 重启Samba服务

# /etc/init.d/smbd restart

六. 退出重新登陆或者重启机器

七. 测试登陆

# smbclient -L //localhost/share

从远程的机子上测试:

# smbclient  //<samba_server_ip>/share

成功咯! :-)

八. 参考资料

Ubuntu中设置samba共享可读写文件夹:
http://forum.ubuntu.org.cn/about20852.html&highlight=samba
http://wiki.ubuntu.org.cn/Samba

 原文链接

 一、局域网内的 Linux 服务器上操作步骤:

  1、安装samba(CentOS Linux):

yum install samba system-config-samba samba-client samba-common



  2、创建www账号

/usr/sbin/groupadd www
/usr/sbin/useradd -g www www

mkdir -p /data0/knose/
chmod 777 /data0/knose/

mkdir -p /data0/htdocs/
chown -R www:www /data0/htdocs/
chmod 777 /data0/htdocs/

cat /etc/passwd | mksmbpasswd.sh> /etc/samba/smbpasswd



  3、创建samba配置文件

mv -f /etc/samba/smb.conf /etc/samba/smb.conf.bak
vi /etc/samba/smb.conf


  输入以下内容:

引用
[global]
server string = Samba Server
security = user
encrypt passwords = yes 
smb passwd file = /etc/samba/smbpasswd

[knose]
workgroup = root
netbios name = root
path = /data0/knose
browseable = yes
writeable = yes

[web]
workgroup = www
netbios name = www
path = /data0/htdocs
browseable = yes
writeable = yes



  4、为samba用户www、root设立一个密码:

smbpasswd -a www
smbpasswd -a root



  5、启动samba:

/sbin/service smb start





  二、局域网内的 Windows 服务器上操作步骤:

  1、Windows 上访问 samba,在“我的电脑”中输入:

\\xxx.xxx.xxx.xxx\



  2、Windows 断开 samba 共享连接,在【开始】→【运行】→【cmd】回车中输入:

net use * /del



  3、将 samba 共享的 Linux 目录,映射成 Windows 的一个驱动器盘符:

  点击在新窗口中浏览此图片

  点击在新窗口中浏览此图片

  点击在新窗口中浏览此图片



  三、跨平台C/C++代码编译、调试:

  用 Windows 下的编辑器编写、修改跨平台的C/C++代码,保存后,无需复制到其他地方,即可同时用 Windows 下的 Visual Studio,Linux 下的 g++、gcc、gdb,编译、调试程序了。

  点击在新窗口中浏览此图片

  点击在新窗口中浏览此图片

  注意:在samba共享的驱动器上执行“.bat”批处理脚本,会导致 Windows 蓝屏,这一点需要注意。


 原文:http://www.unixmen.com/how-to-configure-samba-using-a-graphical-interface-in-ubuntu/

Installing Samba:

First thing we need to do is to install samba, go to Software center in Ubuntu and search for samba then install the package. If you want to install it via terminal then copy this command :

sudo apt-get  install  samba samba-common

Installing Samba Server configuration Tool:

Now install the graphical interface System-config samba

sudo apt-get install system-config-samba

Configuration of samba using a graphical interface:

Now we will try for example to share the directory  /home/pirat9/share folder to do that,

First open GUI samba  server configuration tool by going to System–> Administration–>Samba

Add the  folder you want to share and setup the permissions access.

Now  right click on the  folder directory you want to share and open the  share  options

Then select share this folder

If you want to setup folder access permissions, right click on the folder and open properties (See screenshot bellow)

 

If you want to add a password to the user: open a terminal and type the command  :

sudo  smbpasswd  -a pirat9

and  then type your password.

Now the configuration is done.

Now lets try to check if we can for example connect from a windows machine. To do that

In a windows machine go to start –>Run and type :

 ip  or  hostname

 

 

You will be asked to insert the user and password

Check the  share  folder

And is done.

目录
相关文章
|
Windows
Win系统 - 从USB3.0端口启动安装Windows系统,提示缺少驱动器设备驱动程序的解决办法
Win系统 - 从USB3.0端口启动安装Windows系统,提示缺少驱动器设备驱动程序的解决办法
177 0
Win系统 - 从USB3.0端口启动安装Windows系统,提示缺少驱动器设备驱动程序的解决办法
|
Windows
Windows 技术篇 - win10复制文件或文件夹时出错,提示“文件或目录损坏且无法读取“问题解决。windows驱动器、磁盘修复方法
Windows 技术篇 - win10复制文件或文件夹时出错,提示“文件或目录损坏且无法读取“问题解决。windows驱动器、磁盘修复方法
241 0
Windows 技术篇 - win10复制文件或文件夹时出错,提示“文件或目录损坏且无法读取“问题解决。windows驱动器、磁盘修复方法
|
Ubuntu .NET Linux
从壹开始前后端分离【 .NET Core2.0 +Vue2.0 】框架之十三 || DTOs 对象映射使用,项目部署Windows+Linux完整版
代码已上传Github+Gitee,文末有地址 番外:时间真快,今天终于到了系统打包的日子,虽然项目还是有很多问题,虽然后边还有很多的内容要说要学,但是想着初级基本的.Net Core 用到的基本至少就这么多了(接口文档,项目框架,持久化ORM,依赖注入,AOP,分布式缓存,CORS跨域等等...
1806 0
|
Java Windows
基于Windows下处理Java错误:编码GBK的不可映射字符的解决方案
基于Windows下处理Java错误:编码GBK的不可映射字符的解决方案 最近在研究Java,涉及命令行编译,使用notepad++编辑器,然后使用javac编译; 之前的几个文件没有中文的内容,都没有产生错误,这次有中文就产生这样的错误! 解决方案 方案一、指定编码 javac -encoding utf-8 CommonClassLoader.
1126 0
|
存储 Windows 数据安全/隐私保护
将FTP映射至Windows
在经常使用ftp传输文件的环境中,每次上传和下载文件都需要重新连接然后登录是非常繁琐的一件事情。我们可以将FTP空间映射到本地磁盘空间,免去输入地址以及账号、密码。方便我们日常中文件的上传和下载。 1. 双机桌面上的我的电脑,然后点击映射网络驱动器 2. 选择映射网络驱动器 3. 选择 连接到可用于存储文档和图片的网站 4. 下一步 5. 下一步 5. 根据示例,填写FTP地址 6. 输入用户名。
1612 0
相关产品
云迁移中心
推荐文章
更多