快速配置 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.

目录
相关文章
|
3月前
|
Linux
在 Linux 系统中,“cd”命令用于切换当前工作目录
在 Linux 系统中,“cd”命令用于切换当前工作目录。本文详细介绍了“cd”命令的基本用法和常见技巧,包括使用“.”、“..”、“~”、绝对路径和相对路径,以及快速切换到上一次工作目录等。此外,还探讨了高级技巧,如使用通配符、结合其他命令、在脚本中使用,以及实际应用案例,帮助读者提高工作效率。
232 3
|
15天前
|
存储 Linux
linux中的目录操作函数
本文详细介绍了Linux系统编程中常用的目录操作函数,包括创建目录、删除目录、读取目录内容、遍历目录树以及获取和修改目录属性。这些函数是进行文件系统操作的基础,通过示例代码展示了其具体用法。希望本文能帮助您更好地理解和应用这些目录操作函数,提高系统编程的效率和能力。
68 26
|
9天前
|
Linux Shell
问题记录:解决Linux登录故障,/etc/passwd配置受损该怎么操作
修复/etc/passwd文件是解决Linux登录故障的重要步骤。通过进入单用户模式、挂载文件系统、恢复或手动修复/etc/passwd文件,可以有效解决该问题。保持定期备份系统配置文件是预防此类问题的最佳实践。
37 13
|
9天前
|
Linux
Linux文件与目录的日常
目录的切换 一般使用(”pwd“)显示当前所在的目录 比如:当前目录是在home下面的,与用户名相同的文件夹,可以使用(”cd“)命令来切换目录; 进入下载目录(”cd home/a/下载“)这种从给目录开头的一长串路经”叫做绝对路径“; 进入图片目录(”cd .. /图片/“)".."代表当前路径的上级路径,相对于当前的目录而言的”叫做相对路径“,(”.“)代表当前路径; 如果,想快速切换,上一个所在目录可以(”cd - / cd..“); 如果,想快速切换,追原始的目录可以(”cd --“); 查看目录及文件
35 14
|
8天前
|
Linux Shell
问题记录:解决Linux登录故障,/etc/passwd配置受损该怎么操作
修复/etc/passwd文件是解决Linux登录故障的重要步骤。通过进入单用户模式、挂载文件系统、恢复或手动修复/etc/passwd文件,可以有效解决该问题。保持定期备份系统配置文件是预防此类问题的最佳实践。
25 2
|
2月前
|
Linux
linux查看目录下的文件夹命令,find查找某个目录,但是不包括这个目录本身?
通过本文的介绍,您应该对如何在 Linux 系统中查看目录下的文件夹以及使用 `find` 命令查找特定目录内容并排除该目录本身有了清晰的理解。掌握这些命令和技巧,可以大大提高日常文件管理和查找操作的效率。 在实际应用中,灵活使用这些命令和参数,可以帮助您快速定位和管理文件和目录,满足各种复杂的文件系统操作需求。
160 8
|
2月前
|
Ubuntu Unix Linux
Linux网络文件系统NFS:配置与管理指南
NFS 是 Linux 系统中常用的网络文件系统协议,通过配置和管理 NFS,可以实现跨网络的文件共享。本文详细介绍了 NFS 的安装、配置、管理和常见问题的解决方法,希望对您的工作有所帮助。通过正确配置和优化 NFS,可以显著提高文件共享的效率和安全性。
274 7
|
3月前
|
数据库连接 Linux Shell
Linux下ODBC与 南大通用GBase 8s数据库的无缝连接配置指南
本文详细介绍在Linux系统下配置GBase 8s数据库ODBC的过程,涵盖环境变量设置、ODBC配置文件编辑及连接测试等步骤。首先配置数据库环境变量如GBASEDBTDIR、PATH等,接着修改odbcinst.ini和odbc.ini文件,指定驱动路径、数据库名称等信息,最后通过catalog.c工具或isql命令验证ODBC连接是否成功。
|
3月前
|
运维 监控 网络协议
运维工程师日常工作中最常用的20个Linux命令,涵盖文件操作、目录管理、权限设置、系统监控等方面
本文介绍了运维工程师日常工作中最常用的20个Linux命令,涵盖文件操作、目录管理、权限设置、系统监控等方面,旨在帮助读者提高工作效率。从基本的文件查看与编辑,到高级的网络配置与安全管理,这些命令是运维工作中的必备工具。
331 3
|
3月前
|
Linux Python
Linux 中某个目录中的文件数如何查看?这篇教程分分钟教会你!
在 Linux 系统中,了解目录下文件数量是常见的需求。本文介绍了四种方法:使用 `ls` 和 `wc` 组合、`find` 命令、`tree` 命令以及编程实现(如 Python)。每种方法都附有详细说明和示例,适合不同水平的用户学习和使用。掌握这些技巧,可以有效提升系统管理和日常使用的效率。
1929 6