Linux(Debian)中的Samba伺服器的配置
配置Samba伺服器分為4步:
1.apt-get install samba (安裝)
2.建立使用者 ( 注意:該使用者是系統中已經存在的使用者,以debian為例)
在系統中建立test使用者debian~:# useradd -m test
增加samba使用者debian~:#smbpasswd -a test
3.編輯配置檔案:
vi /etc/samba/smb.conf(smb.conf是個配置檔案)
加入我們的配置資訊:
========Share Definitions ===============
[share]設定共享名稱
comment=目錄的註解說明
path= /data/temp要共享目錄的絕對位置
以下屬可選擇項目錄
browseable=no目錄是否可見,預設為可見
writable= yes目錄是否為可寫
readonly = no目錄是否為只讀
guestok = yes來賓是否可以訪問,與"public = yes" 作用相同
writelist =user,@group可寫清單,@後表示某個群組
validusers = ...允許訪問的使用者清單
readlist=...只可讀的使用者清單
invalidusers = ...禁止訪問的使用者清單
adminusers = ...有管理許可權使用者清單
createmask = 0755使用者建立檔案的許可權,預設為0744
4.重啟一下samba服務:(在配置完後必須要重啟一下)
/etc/init.d/samba restart
補充:# chmod 775 /home(window可以寫)//修改許可權
5.不要忘記相應目錄的授權(否則不能讀寫),檢查當前配置 # testparm
關閉伺服器可用 smbcontrol 這個程式。命令格式如下:
debian~:# smbcontrol smbd shutdown
6.具體操作:
假設windows下IP為192.168.0.7debian下的IP 為:192.168.0.8
在Windows中執行\\192.168.0.8,即可進入共享資料夾
可能出現的問題:可以登入samba伺服器,但是沒有許可權訪問linux下的共享目錄
1、確保linux下防火牆關閉或者是開放共享目錄許可權 iptalbes -F
2、確保samba伺服器配置檔案smb.conf設定沒有問題,可網上查閱資料看配置辦法
3、確保setlinux關閉,可以用setenforce 0命令執行。 預設的,SELinux禁止網路上對Samba伺服器上的共享目錄進行寫操作,即使你在smb.conf中允許了這項操作。
Debian下如何關閉setlinux:
先安裝控制軟體:#apt-getupdate#apt-get install -y selinux-utils#apt-getinstall -y setools
當前系統中,立即關閉setlinux服務:#/usr/sbin/setenforce 0檢查是否已經 成功 關閉服務:#getenforce
通過Samba伺服器實現windows和Linux之間的檔案共享,相信是絕大多數人的選擇。通常我們都會使用Samba的預設配置,這樣,每次通過Samba從Windows向Linux中拷貝檔案時,檔案都會被加上”可執行”的屬性。這是很讓人頭疼的問題,每次都要通過chmod去修改檔案的許可權很是麻煩。
今天仔細看了一下Samba的手冊,發現只要把下面的配置加入/etc/samba/smb.conf就可以解決這個問題:
1.create mode = 0644
2.force create mode = 0644
3.directory mode = 0755
4.force directory mode = 0755
這些引數加在任何地方都可以
下面是一個配置檔案示例。
#
# 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
#
# Any line which starts with a ; (semi-colon) or a # (hash)
# is a comment and is ignored. In this example we will use a #
# for commentary and a ; for parts of the config file that you
# may wish to enable
#
# NOTE: Whenever you modify this file you should run the command
# "testparm" to check that you have not many any basic syntactic
# errors.
#
#======================= Global Settings =======================
[global]
## Browsing/Identification ###
# Change this to the workgroup/NT-domain name your Samba server will part of
workgroup= DEBIAN_FANS
# server string is the equivalent of the NT Description field
serverstring = %h server (Samba %v)
# 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.
dnsproxy = no
# What naming service and in what order should we use to resolve host names
# to IP addresses
;name resolve order = lmhosts host wins bcast
#### Debugging/Accounting ####
# This tells Samba to use a separate log file for each machine
# that connects
logfile = /var/log/samba/log.%m
# Put a capping on the size of the log files (in Kb).
maxlog 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 backtrace
panicaction = /usr/share/samba/panic-action %d
####### Authentication #######
# "security = user" is always a good idea. This will require a Unix account
# in this server for every user accessing the server. See
# /usr/share/doc/samba-doc/htmldocs/ServerType.html in the samba-doc
# package for details.
security= user
# You may wish to use password encryption.See the section on
# 'encrypt passwords' in the smb.conf(5) manpage before enabling.
encryptpasswords = yes
# If you are using encrypted passwords, Samba will need to know what
# password database type you are using.
passdbbackend = tdbsam guest
obeypam restrictions = yes
;guest account = nobody
invalidusers = root
# 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 = no
# For Unix password sync to work on a Debian GNU/Linux system, the following
# parameters must be set (thanks to Augustin Luton <[email protected]> for
# sending the correct chat script for the passwd program in Debian Potato).
passwdprogram = /usr/bin/passwd %u
passwdchat = *Enter\snew\sUNIX\spassword:* %n\n *Retype\snew\sUNIX\spassword:* %n\n .
# 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 = no
########## Printing ##########
# If you want to automatically load your printer list rather
# than setting them up individually then you'll need this
;load printers = yes
# lpr(ng) printing. You may wish to override the location of the
# printcap file
;printing = bsd
;printcap name = /etc/printcap
# CUPS printing.See also the cupsaddsmb(8) manpage in the
# cupsys-client package.
;printing = cups
;printcap name = cups
# When using [print$], root is implicitly a 'printer admin', but you can
# also give this right to other users to add drivers and set printer
# properties
;printer admin = @ntadmin
######## File sharing ########
# Name mangling options
;preserve case = yes
;short preserve case = yes
############ 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
# Most people will find that this option gives better performance.
# See smb.conf(5) and /usr/share/doc/samba-doc/htmldocs/speed.html
# for details
# You may want to add the following on a Linux system:
#SO_RCVBUF=8192 SO_SNDBUF=8192
socketoptions = TCP_NODELAY
# The following parameter is useful only if you have the linpopup package
# installed. The samba maintainer and the linpopup maintainer are
# working to ease installation and configuration of linpopup and samba.
;message command = /bin/sh -c '/usr/bin/linpopup "%f" "%m" %s; rm %s' &
# Domain Master specifies Samba to be the Domain Master Browser. If this
# machine will be configured as a BDC (a secondary logon server), you
# must set this to 'no'; otherwise, the default behavior is recommended.
;domain master = auto
# 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
#======================= Share Definitions =======================
[homes]
comment= Home Directories
browseable= yes
# By default, the home directories are exported read-only. Change next
# parameter to 'yes' if you want to be able to write to them.
writable= no
# 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.
createmask = 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.
directorymask = 0700
# 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
;writable = no
;share modes = no
[printers]
comment= All Printers
browseable= no
path= /tmp
printable= yes
public= no
writable= no
createmode = 0700
# Windows clients look for this share name as a source of downloadable
# printer drivers
[print$]
comment= Printer Drivers
path= /var/lib/samba/printers
browseable= yes
readonly = yes
guestok = no
# Uncomment to allow remote administration of Windows print drivers.
# Replace 'ntadmin' with the name of the group your admin users are
# members of.
;write list = root, @ntadmin
# A sample share for sharing your CD-ROM with others.
;[cdrom]
;comment = Samba server's CD-ROM
;writable = no
;locking = no
;path = /cdrom
;public = yes
# The next two parameters show how to auto-mount a CD-ROM when the
#cdrom share is accesed. For this to work /etc/fstab must contain
#an entry like this:
#
#/dev/scd0/cdromiso9660 defaults,noauto,ro,user0 0
#
# The CD-ROM gets unmounted automatically after the connection to the
#
# If you don't want to use auto-mounting/unmounting make sure the CD
#is mounted on /cdrom
#
;preexec = /bin/mount /cdrom
;postexec = /bin/umount /cdrom相關推薦
Linux(Debian)中的Samba伺服器的配置
配置Samba伺服器分為4步: 1.apt-get install samba (安裝) 2.建立使用者 ( 注意:該使用者是系統中已經存在的使用者,以debian為例) 在系統中建立test使用者debian~:# useradd -m test 增加samba使用
阿里雲 Linux(CentOS)中Redis配置注意事項
1,執行的Redis伺服器提示找不到該命令: 執行ln -s /root/redis-2.8.17/src/redis-server / usr / bin / redis-server,為redis-server建立軟連線,其中/root/redis-2.8.17/src/為我redis安裝目
阿里雲 Linux(CentOS)中MySQL5.7安裝配置以及遠端連線配置最新完整版
1, mysql57-community-release-el7-11.noarch.rpm 點選下載並上傳到阿里雲。 2,切換資料夾,然後一步步輸入下面三條命令,即安裝好的MySQL的 (1),rpm -ivh mysql57-community-release-el7-1
linux(debian)系統中安裝RabbitMQ
首先要安裝RabbitMQ,需要安裝ncurses-devel和erlang 安裝命令: tar -zxvf ncurses-6.0.tar.gz cd ncurses-6.0 ./configure --with-shared --without-de
純淨版linux (debian)掛載VirtualBox共享資料夾 virtual box虛擬機器在linux下設定共享資料夾
使用的虛擬機器版本是:VirtualBox-5.2.8-121009 使用的linux版本是:Linux debian 4.9.0-7-amd64 tty 1. 開始配置 1.1:開啟虛擬機器設定,開啟你的VirtualBox軟體(主要先不要開啟linux系統)。選中你的虛擬機器後,
linux(centos7)中安裝mysql,修改密碼,遠端連線,從sqlyog連線一套教程(自己整理,筆記)
2.開啟MySQL遠端訪問許可權 允許遠端連線 改表法: use mysql; update user set host = '%' where user = 'root'; FLUSH PRIVILEGES; ps:網上還要修改防火牆的方法,我沒成功,
Linux(docker)中 mysql 表名大小寫區分
問題: 在docker中使用mysql,通過sql檔案匯入資料庫的時候,建立的表名都是大寫字母,而程式中都是用的小寫,碰到了下面這種錯誤: mysql> select * from task_schedule_job; ERROR 1146 (42S0
在Linux(Ubuntu)中使用終端編譯並執行.c和.cpp檔案
首先要保證系統中安裝了C語言和C++對應的編譯器:gcc -> C ,g++ -> C++1、.c檔案的編譯與執行(1).c檔案hello.c程式碼如下:#include<stdio.h> int main() { printf("H
Linux(CentOS7)中redis相關
redis安裝 在安裝redis之前,需要安裝gcc編譯器。然後從官網下載redis的解壓包,上傳至伺服器指定的目錄,然後解壓、編譯。安裝的時候要指定安裝目錄。 安裝 gcc 編譯器,利用 yum 源進行安裝,如果不能線上
在Windows 10 自帶的Linux(Ubuntu)中安裝redis 步驟Mark
安裝步驟參考:https://blog.csdn.net/xiangwanpeng/article/details/54586087問題一:安裝完gcc後執行make命令的時候出現 'make' can be found in the following packages:於
Linux(Ubuntu)中改變敲入sudo之後記住密碼的時間
在使用Ubuntu時可能會遇到當敲入sudo XXX XXX….$: 之後系統會記錄密碼一段時間,如果想要改變這個記錄的時間(系統預設是5分鐘),方法如下: 輸入sudo visudo 找到”Defaults env_reset”行(如果沒有找到,就直接加入
Linux下最完整的Samba伺服器配置攻略
關於Samba,大家有沒有這種感覺,弄了N久丫的死活不喘氣兒。找來各種“哥”和“姐”,發現全是“詳解…配置專題”,看了半天不知道別個在說什麼,好不容易找了個簡單的教程,從頭到尾跟著做,尼瑪,浪費時間精力不說,就是跑不起來。是不是有種吐血的生理反應了。唉,不會寫文件的娃,傷
到目前為止,Linux下最完整的Samba伺服器配置攻略
關於Samba,大家有沒有這種感覺,弄了N久丫的死活不喘氣兒。找來各種“哥”和“姐”,發現全是“詳解…配置專題”,看了半天不知道別個在說什麼,好不容易找了個簡單的教程,從頭到尾跟著做,尼瑪,浪費時間精力不說,就是跑不起來。是不是有種吐血的生理反應了。唉,不會寫文件的娃,傷不起啊。而本文實現的是Linux和
linux(centos7)下SVN伺服器如何搭建
linux(centos)下SVN伺服器如何搭建?說到SVN伺服器,想必大家都知道,可以是在LINUX下如何搭建SVN伺服器呢?那麼今天給大家分享一下linux(centos)搭建SVN伺服器的思路! 雖然在windows上搭建SVN很簡單,但是效能卻不高,這
linux(ubuntu)中一些特殊符號
? 匹配一個字元 * 匹配任意字串 () 開一個子程序,見程式碼 sorrow@ubuntu:~$ (ccc=1000) sorrow@ubuntu:~$ (echo $ccc) sorrow@ubuntu:~$ echo $ccc
Linux(Debian)下Maven的安裝
命名 版本 配置環境 debian amd jre group 1.8 platform Maven的下載地址:http://maven.apache.org/download.cgi 這裏以最新的3.3.9版本為例進行安裝,在這之前需要確保機器上已經安裝了JDK。 在ho
Linux(Centos7)下,阿帕奇(Apache)伺服器的安裝與配置
Y6 Apache是世界使用排名第一的Web伺服器軟體。它可以執行在幾乎所有廣泛使用的計算機平臺上,由於其跨平臺和安全性被廣泛使用,是最流行的Web伺服器端軟體之一。它快速、可靠並且可通過簡單的API擴充,將Perl/Python等直譯器編譯到伺服器中。 下面介紹Apac
Linux(六)Linux系統中安裝配置JDK
1.首先將JDK安裝檔案拷貝到Linux系統中 這裡我是在虛擬機器中操作,我通過共享資料夾進行檔案傳輸,如果是遠端Linux系統可以使用xftp(在我前面部落格講過如何使用)進行檔案傳輸。 從共享資料夾中拷貝到/usr/local/目錄下 2.對壓縮包進行解
Linux配置tomcat啟動服務(debian)
1.配置catalina.sh啟動指令碼 # 進入tomcat安裝位置bin目錄 cd /usr/lib/tomcat8.5.31/bin # 配置 vim catalina.sh # 在指令碼頂部增加服務描述 ### BEGIN INIT INFO # Provides:
老牛知點所以然-Linux(Ubuntu)配置安卓開發環境及過程中常見問題解決
[TOC] 題記: 這篇部落格基本上是半年多實踐過程中積累到筆記中的。在第二次配置完開發環境後,我就有意識的把大概的配置過程形成了一個筆記,這半年多將近一年的時間裡,陸續發現了一些不足和謬誤,還有以前踩過的坑沒有及時記下來,最近又踩過的,逐漸補充了過來,算是