Samba共享Ubuntu文件到Windows中

为甚?

在你学习计算机的时候,你是否有这样的经历?

Windows 开发环境,Linux 开发环境,到底选那个?

  • A:Linux 开发很方便,上手后用起来直接起飞...
  • B:Linux 没有Office Word 写文档什么的很麻烦...
  • A:可是有些编译只有在Linux上的说明啊,我这Makefile你windows怎么搞?
  • C:你看我装双系系统,都能干
  • AB:开机装引导不怕装成砖?
  • D:用Mac啊,反正我有三个电脑,三个系统
  • ABC:? ? ?
  • E:搭个Vmware虚拟机不就完事了
  • ABC:文件传来传去?还是不行啊

解决方法

使用的环境,需要有这些优点:

  • Windows Linux 系统同时运行,
  • Windows Linux 文件方便互相打开
  • 安全,方便

上文提到的所有开发环境我都有尝试过,由于经常要写文档(不要问我为森马不用Latex),剪辑视频,所以就使用Windows + Ubuntu这个组合方式,Ubuntu下就是写点东西,负载不是很重(除了编译东西之外)但是Ubuntu 一般不使用图形界面,所以用虚拟机也是不会有太大差别。

那么我给的解决方案就是 Windows + Ubuntu 某人:Windows + Linux Server 不一样嘛 你 Server 没Desktop 图形界面啊,玩尬的吗? 好的我们进入正题,(好的我们进入游戏画面,@罗汉解说) 怎么共享文件呢?使用Vmware 共享文件到 windows,嗯..... 可以 不过效率如何我不清楚,

我的选择是,直接给Ubuntu虚拟机挂一个物理磁盘分区,然后将这个分区共享, 使用体验感觉,共享后在Windows下打开共享的东西就像打开一个文件夹一样。 好的我们介绍下如何配置,以及都可能碰到的坑...

配置

Windows避开的坑,

开启Windows SMB Feature

Control PanelAll Control Panel ItemsPrograms and Features

注册表选项

samba_sharing_fix_windows10.reg
Windows Registry Editor Version 5.00[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesLanmanWorkstationParameters]
"AllowInsecureGuestAuth"=dword:00000001

Ubuntu Install samba

sudo apt-get install samba
sudo apt-get install samba-common-bin=2:4.3.8+dfsg-0ubuntu1
sudo apt-get install python-samba
sudo apt-get install python-ldb
sudo apt-get instal libldb1=2:1.1.24-1ubuntu3
sudo apt-get install libldb1=2:1.1.24-1ubuntu3
sudo apt-get install python-ldb
sudo apt-get install python-samba
sudo apt-get install samba

Ubuntu config Smb.conf

#
# Sample configuration file for the Samba suite for Debian GNU/Linux.
#
#
# This is the main Samba configuration file. You should read the
# smb.conf(5) manual page in order to understand the options listed
# here. Samba has a huge number of configurable options most of which
# are not shown in this example
#
# Some options that are often worth tuning have been included as
# commented-out examples in this file.
#  - When such options are commented with ";", the proposed setting
#    differs from the default Samba behaviour
#  - When commented with "#", the proposed setting is the default
#    behaviour of Samba but the option is considered important
#    enough to be mentioned here
#
# NOTE: Whenever you modify this file you should run the command
# "testparm" to check that you have not made any basic syntactic
# errors. #======================= Global Settings =======================[global]## Browsing/Identification #### Change this to the workgroup/NT-domain name your Samba server will part ofworkgroup = WORKGROUP# server string is the equivalent of the NT Description fieldserver string = %h server (Samba, Ubuntu)# Windows Internet Name Serving Support Section:
# WINS Support - Tells the NMBD component of Samba to enable its WINS Server
#   wins support = no# WINS Server - Tells the NMBD components of Samba to be a WINS Client
# Note: Samba can be either a WINS Server, or a WINS Client, but NOT both
;   wins server = w.x.y.z# This will prevent nmbd to search for NetBIOS names through DNS.dns proxy = no#### Networking ##### The specific set of interfaces / networks to bind to
# This can be either the interface name or an IP address/netmask;
# interface names are normally preferred
;   interfaces = 127.0.0.0/8 eth0# Only bind to the named interfaces and/or networks; you must use the
# 'interfaces' option above to use this.
# It is recommended that you enable this feature if your Samba machine is
# not protected by a firewall or is a firewall itself.  However, this
# option cannot handle dynamic or non-broadcast interfaces correctly.
;   bind interfaces only = yes#### Debugging/Accounting ##### This tells Samba to use a separate log file for each machine
# that connectslog file = /var/log/samba/log.%m# Cap the size of the individual log files (in KiB).max log size = 1000# If you want Samba to only log through syslog then set the following
# parameter to 'yes'.
#   syslog only = no# We want Samba to log a minimum amount of information to syslog. Everything
# should go to /var/log/samba/log.{smbd,nmbd} instead. If you want to log
# through syslog you should set the following parameter to something higher.syslog = 0# Do something sensible when Samba crashes: mail the admin a backtracepanic action = /usr/share/samba/panic-action %d####### Authentication ######## Server role. Defines in which mode Samba will operate. Possible
# values are "standalone server", "member server", "classic primary
# domain controller", "classic backup domain controller", "active
# directory domain controller".
#
# Most people will want "standalone sever" or "member server".
# Running as "active directory domain controller" will require first
# running "samba-tool domain provision" to wipe databases and create a
# new domain.server role = standalone server# If you are using encrypted passwords, Samba will need to know what
# password database type you are using.  passdb backend = tdbsamobey pam restrictions = yes# This boolean parameter controls whether Samba attempts to sync the Unix
# password with the SMB password when the encrypted SMB password in the
# passdb is changed.unix password sync = yes# For Unix password sync to work on a Debian GNU/Linux system, the following
# parameters must be set (thanks to Ian Kahan <<kahan@informatik.tu-muenchen.de> for
# sending the correct chat script for the passwd program in Debian Sarge).passwd program = /usr/bin/passwd %upasswd chat = *Entersnews*spassword:* %nn *Retypesnews*spassword:* %nn *passwordsupdatedssuccessfully* .# This boolean controls whether PAM will be used for password changes
# when requested by an SMB client instead of the program listed in
# 'passwd program'. The default is 'no'.pam password change = yes# This option controls how unsuccessful authentication attempts are mapped
# to anonymous connectionsmap to guest = bad userarchive = no
########## Domains ############
# The following settings only takes effect if 'server role = primary
# classic domain controller', 'server role = backup domain controller'
# or 'domain logons' is set
## It specifies the location of the user's
# profile directory from the client point of view) The following
# required a [profiles] share to be setup on the samba server (see
# below)
;   logon path = %Nprofiles%U
# Another common choice is storing the profile in the user's home directory
# (this is Samba's default)
#   logon path = %N%Uprofile# The following setting only takes effect if 'domain logons' is set
# It specifies the location of a user's home directory (from the client
# point of view)
;   logon drive = H:
#   logon home = %N%U# The following setting only takes effect if 'domain logons' is set
# It specifies the script to run during logon. The script must be stored
# in the [netlogon] share
# NOTE: Must be store in 'DOS' file format convention
;   logon script = logon.cmd# This allows Unix users to be created on the domain controller via the SAMR
# RPC pipe.  The example command creates a user account with a disabled Unix
# password; please adapt to your needs
; add user script = /usr/sbin/adduser --quiet --disabled-password --gecos "" %u# This allows machine accounts to be created on the domain controller via the
# SAMR RPC pipe.
# The following assumes a "machines" group exists on the system
; add machine script  = /usr/sbin/useradd -g machines -c "%u machine account" -d /var/lib/samba -s /bin/false %u# This allows Unix groups to be created on the domain controller via the SAMR
# RPC pipe.
; add group script = /usr/sbin/addgroup --force-badname %g############ Misc ############# Using the following line enables you to customise your configuration
# on a per machine basis. The %m gets replaced with the netbios name
# of the machine that is connecting
;   include = /home/samba/etc/smb.conf.%m# Some defaults for winbind (make sure you're not using the ranges
# for something else.)
;   idmap uid = 10000-20000
;   idmap gid = 10000-20000
;   template shell = /bin/bash# Setup usershare options to enable non-root users to share folders
# with the net usershare command.# Maximum number of usershare. 0 (default) means that usershare is disabled.
;   usershare max shares = 100# Allow users who've been granted usershare privileges to create
# public shares, not just authenticated onesusershare allow guests = yes#======================= Share Definitions =======================# Un-comment the following (and tweak the other settings below to suit)
# to enable the default home directory shares. This will share each
# user's home directory as serverusername
;[homes]
;   comment = Home Directories
;   browseable = no# By default, the home directories are exported read-only. Change the
# next parameter to 'no' if you want to be able to write to them.
;   read only = yes# File creation mask is set to 0700 for security reasons. If you want to
# create files with group=rw permissions, set next parameter to 0775.
;   create mask = 0700# Directory creation mask is set to 0700 for security reasons. If you want to
# create dirs. with group=rw permissions, set next parameter to 0775.
;   directory mask = 0700# By default, serverusername shares can be connected to by anyone
# with access to the samba server.
# Un-comment the following parameter to make sure that only "username"
# can connect to serverusername
# This might need tweaking when using external authentication schemes
;   valid users = %S# Un-comment the following and create the netlogon directory for Domain Logons
# (you need to configure Samba to act as a domain controller too.)
;[netlogon]
;   comment = Network Logon Service
;   path = /home/samba/netlogon
;   guest ok = yes
;   read only = yes# Un-comment the following and create the profiles directory to store
# users profiles (see the "logon path" option above)
# (you need to configure Samba to act as a domain controller too.)
# The path below should be writable by all users so that their
# profile directory may be created the first time they log on
;[profiles]
;   comment = Users profiles
;   path = /home/samba/profiles
;   guest ok = no
;   browseable = no
;   create mask = 0600
;   directory mask = 0700# --------------------------- Filesystem Options ---------------------------
#
# The following options can be uncommented if the filesystem supports
# Extended Attributes and they are enabled (usually by the mount option
# user_xattr). Thess options will let the admin store the DOS attributes
# in an EA and make samba not mess with the permission bits.
#
# Note: these options can also be set just per share, setting them in global
# makes them the default for all sharesmap archive = nomap hidden = nomap read only = nomap system = nostore dos attributes = yes[printers]comment = All Printersbrowseable = nopath = /var/spool/sambaprintable = yesguest ok = noread only = yescreate mask = 0700# Windows clients look for this share name as a source of downloadable
# printer drivers
[print$]comment = Printer Driverspath = /var/lib/samba/printersbrowseable = yesread only = yesguest ok = no
# Uncomment to allow remote administration of Windows print drivers.
# You may need to replace 'lpadmin' with the name of the group your
# admin users are members of.
# Please note that you also need to set appropriate Unix permissions
# to the drivers directory for these users to have write rights in it
;   write list = root, @lpadmin
[share]comment = share folderbrowseable = yespath = /datavalid users = wangzhuipublic = yesavailable = yesread only = nowriteable = yes

Ubuntu Start Samba

wangzhui@movestation:/data$ sudo /etc/init.d/samba restart
[sudo] password for wangzhui:
[ ok ] Restarting nmbd (via systemctl): nmbd.service.
[ ok ] Restarting smbd (via systemctl): smbd.service.
[ ok ] Restarting samba-ad-dc (via systemctl): samba-ad-dc.service.

Test

ubuntu没有interfaces文件_Samba共享Ubuntu文件到Windows中相关推荐

  1. 更改文件类型图标logo_如何在Windows中更改特定文件类型的图标

    更改文件类型图标logo In the Windows XP days, changing the icon for a specific file type-such as TXT or PNG-w ...

  2. centos7共享网络盘_实验08:局域网文件和互联网文件的共享

    一.[实验目的] 1.  设置简单的文件夹共享 2.  文件传输协议FTP的简单应用 3.互联网文件共享百度云盘的使用 二.[实验器材] 两台物理机windows7系统环境: 设备 IP地址 用途 W ...

  3. Parallels Desktop分享:文件夹共享技巧

    Parallels Desktop 允许您在 macOS 与 Windows 文件系统之间共享文件夹,以便您从 Windows 应用程序打开 macOS 的文件和从 macOS 应用程序打开 Wind ...

  4. 文件夹删不掉?有种文件夹叫 畸形文件夹

    右键删除 删不掉. 用命令行 rd命令  删除,找不到文件. 文件粉碎机 粉碎无效果. 在网上查到这个命令 DEL /F /A /Q \\?\%1   RD /S /Q \\?\%1 新建文本文档,然 ...

  5. Ubuntu下配置samba实现文件夹共享

    Ubuntu下配置samba实现文件夹共享 一.samba的安装: sudo apt-get intall samba sudo apt-get install smbfs 二.创建共享目录: mkd ...

  6. 虚拟机下Ubuntu共享主机文件(Ubuntu、VMware、共享) .

    摘要:   使用虚拟机运行Ubuntu时,主机与宿主机共享文件的方法. 简介: 首先设置虚拟机: 虚拟机 -> 设置 -> Hardware -> Network Adapter,在 ...

  7. linux共享文件可读写,在Ubuntu中设置samba共享可读写文件夹

    在Ubuntu中设置samba共享可读写文件夹 发布时间:2007-03-15 01:01:08来源:红联作者:XLooking 首先当然是要安装samba了,呵呵: sudo apt-get ins ...

  8. 【环境搭建001】ubuntu 和 win7 在vm 下的文件夹共享实践

    ubuntu 和 win7 是vm下linux开发最常用的搭配了. 方法 1: 1. 选择VMware Workstation程序菜单中Virtual Machine Settings-->Op ...

  9. VMWare共享windows文件夹到Ubuntu虚拟机

    1.Windows下设置共享文件 右键目标文件夹 - 属性 - 共享 共享(S)... - 查找用户 - 选择Everyone - 添加 - 选中 - 共享(H) 2.修改共享设置 控制面板 - 网络 ...

最新文章

  1. Centos7上yum安装redis
  2. 进程和线程你真的搞懂了吗?
  3. 【Java 网络编程】TCP API 简介 ( Socket | ServerSocket )
  4. C指针原理(21)-C指针基础-ATT汇编
  5. docker run 原理
  6. OAuth2.0学习(2-1)Spring Security OAuth2.0 开发指南
  7. 垂直居中及容器内图片垂直居中的CSS解决方法
  8. cobalt strick 4.0 系列教程(6)Payload Artifact 和反病毒规避
  9. Spring Cloud面试题
  10. android lottie字体json,Android 动画深入Lottie
  11. 推荐一个wpfsliverlight的图表控件
  12. app-debug.apk does not exist on disk
  13. Appium 屏幕页面滑动(swipe函数实现)
  14. android studio乱码
  15. netron可以下载某一层的权重
  16. layui table动态选中_NeurIPS 2020 | 伯克利新工作: 基于动态关系推理的多智能体轨迹预测问题...
  17. 使用gdal的ogr创建shapefile文件(c++)
  18. Python输出一个绕圈圈的矩阵
  19. 做B端产品经理好还是做C端产品经理好?
  20. Android Paging3的使用

热门文章

  1. Windows 远程桌面管理
  2. OpenCV学习(19) 细化算法(7)
  3. 如何在线程中获取spring 管理的bean
  4. Ubuntu下gedit的相关问题
  5. python 得到文件行数
  6. linux anacron 定时任务 计划任务
  7. linux ldconfig 与 /etc/ld.so.conf 动态函数库配置
  8. python微型web框架flask介绍
  9. windbg-.process切换进程
  10. DbgPrint/KdPrint输出格式控制