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

原文链接

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=sambahttp://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.

时间: 2024-08-17 14:46:56

快速配置 Samba 将 Linux 目录映射为 Windows 驱动器的相关文章

将CentOS服务器的目录映射为Windows磁盘驱动器的方法

  1.安装samba(centos 5.5): 代码如下: yum install samba system-config-samba samba-client samba-common 2.创建www账号 代码如下: /usr/sbin/useradd www mkdir -p /data/www chmod 777 /data/www chown -R www:www /data/www cat /etc/passwd | mksmbpasswd.sh> /etc/samba/smbpas

使用 Samba 实现 Linux 与 Windows 文件共享实践

前言 一直以来都以为FTP和NFS是局域网文件共享的常用方式,但是在最近接触Samba之后,了解到一些用户需要简化访问学习成本,满足基础的权限控制管理,并支持实时编辑和保存文件,我才明白这些需求使用之前的方法都是很难满足的,而Samba却可以完美的支持上述需求,虽然在开始接触时花了一些时间学习,但把配置和语法梳理清楚之后就很简单了. Unix与Windows文件共享的最佳方式之一 安装samba 各个平台的安装都蛮简单的,略过 配置samba 建议合理规划目录和用户权限,可以利用用户组来简化授权

Samba 系列(七):在 Samba AD DC 服务器上创建共享目录并映射到 Windows/Linux 客户

需求: 1.在 Ubuntu 系统上使用 Samba4 来创建活动目录架构 2.在 Linux 命令行下管理 Samba4 AD 架构 3.使用 Windows 10 的 RSAT 工具来管理 Samba4 活动目录架构 4.在 Windows 下管理 Samba4 AD 域管制器 DNS 和组策略 5.将另一台 Ubuntu DC 服务器加入到 Samba4 AD DC 实现双域控主机模式 6.使用 Rsync 命令同步两个 Samba4 AD DC 之间的 SysVol 目录 第一步:创建

redhat如何安装配置samba实现win共享linux主机目录

redhat安装配置samba实现win共享linux主机目录 一.安装前准备 1.使用Samba服务器需要防火墙开放以下端口 UDP 137 UDP 138 TCP 139 TCP 445 #配置防火墙端口  www.2cto.com [root@roothomes ~] vi /etc/sysconfig/iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT -A INPUT -m state -

快速配置Linux + Eclipse + wxWidgets开发环境

本文为原创,如需转载,请注明作者和出处,谢谢!     wxWidgets是一个跨平台的C++开发库,与MFC类似.不过配置起来比较麻烦,如果在Linux下使用Eclipse来开发基于wxWidgets的应用程序需要进行一系列的配置,如设置include路径.library路径等.但我们可以使用一个简单的方法来快速配置wxWidgets.     在wxWidgets发行发中有很多例子,随便编译一个例子(执行make命令),就会在终端中看到生成.o和可执行文件的完整命令.如果要编译自己写的程序,

如何在Linux环境下架设和配置Samba服务器

Windows可以通过网上邻居访问局域网主机,而在Linux下则可以通过Samba客户端访问局域网内的Windows主机,也可以通过Samba服务器给Windows主机提供文件.打印机等服务.下面,小编就给大家介绍一下如何在Linux环境下架设和配置Samba服务器,为了方便讲述,这里假设Windows主机的计算机名为http://www.aliyun.com/zixun/aggregation/29867.html">Peter,设Linux主机的名称为RedHat. 一.安装Samba

Linux下安装配置Samba教程整理

Samba可以实现Linux与Win之间的文件共享,在内部开发文档共享上还是极好的.   安装Samba   查看Samba是否已安装 # rpm -qa | grep samba 通过yum直接安装Samba服务端和客户端 #yum -y install samba samba-client Samba的主配置文件为/etc/samba/smb.conf,这里主要达到在win下通过帐号登录linux共享即可,复杂的配置可参考最后的地址.直接在smb.conf后加上一段共享块. [public]

用 Docker 快速配置前端开发环境

本文讲的是用 Docker 快速配置前端开发环境[编者的话]最近在公司实践了一下 Docker,记录成了一篇文章,发出来和大家交流下.我基本上是个 Docker 新手,如果有什么地方说得不对请大家指出~目前的方案还比较粗糙,大家有什么改进建议也请告诉我,我多和大家学习 今天是你入职第一天. 你起了个大早,洗漱干净带着材料去入职. 签了合同,领了机器,坐到工位,泡一杯袋装红茶,按下开机键,输入密码, 然后,下载 Chrome.Postman.Sublime.盗版 PS.NodeJS.配置 NODE

linux学习笔记 linux目录架构_unix linux

linux目录架构   / 根目录   /bin 常用的命令 binary file 的目錄   /boot 存放系统启动时必须读取的档案,包括核心 (kernel) 在内   /boot/grub/menu.lst GRUB设置   /boot/vmlinuz 内核   /boot/initrd 核心解壓縮所需 RAM Disk   /dev 系统周边设备   /etc 系统相关设定文件   /etc/DIR_COLORS 设定颜色   /etc/HOSTNAME 设定用户的节点名   /et