# See smb.conf.example for a more detailed config file or # read the smb.conf manpage. # Run 'testparm' to verify the config is correct after # you modified it. [global] workgroup = SAMBA security = user passdb backend = tdbsam printing = cups printcap name = cups load printers = yes cups options = raw [printers] comment = All Printers path = /var/tmp printable = Yes create mask = 0600 browseable = No [print$] comment = Printer Drivers path = /var/lib/samba/drivers write list = @printadmin root force group = @printadmin create mask = 0664 directory mask = 0775 [xxk_data] comment='信息科专用' path=/home/data public=no writable=yes
https://www.cnblogs.com/yinheyi/p/6269576.html
安装主要采用yum进行
采用阿里的base+epel
yum -y install samba
systemctl enable smb
mkdir -p /home/data
useradd smbuser
pdbedit -a -u smbuser
cd /home/
chown -R smbuser.smbuser data/
vim /etc/samba/smb.conf
[xxk_data]
comment='信息科专用'
path=/home/data
public=no
writable=yes
systemctl restart smb
如果比较卡慢的话请注意
请按照/etc/hosts和/etc/sysconfig/network文件进行修改
查看目录的大小
du -sh *
# add at 18-09-30 解决xp无法访问samba服务的问题
当遇到xp电脑无法打开samba部署的公共盘时
查阅有的资料认为xp不支持高版本的samba服务
为此修改配置文件
[global]
workgroup = SAMBA
security = user
passdb backend = tdbsam
printing = cups
printcap name = cups
load printers = yes
cups options = raw
ntlm auth = yes
修改后的配置文件为:
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
# See smb.conf.example for a more detailed config file or # read the smb.conf manpage. # Run 'testparm' to verify the config is correct after # you modified it. [global] workgroup = SAMBA security = user passdb backend = tdbsam printing = cups printcap name = cups load printers = yes cups options = raw ntlm auth = yes [printers] comment = All Printers path = /var/tmp printable = Yes create mask = 0600 browseable = No [print$] comment = Printer Drivers path = /var/lib/samba/drivers write list = @printadmin root force group = @printadmin create mask = 0664 directory mask = 0775 [xxk_data] comment='信息科专用' path=/home/data public=no writable=yes
###新增定时任务校对时间
内网时间服务器地址为172.20.91.54
echo '#time sync by nodchen at 18-09-30' >/var/spool/cron/root
echo '*/5 * * * * /usr/sbin/ntpdate timeserver >/dev/null 2>&1' >/var/spool/cron/root
crontab -l
###新增处理图形界面休眠问题
以下功能待测试
[root@samba ~]# cd /etc/X11/
[root@samba X11]# cat xorg.conf
Section "ServerFlags"
Option "BlankTime" "0"
Option "StandbyTime" "0"
Option "SuspendTime" "0"
Option "OffTime" "0"
EndSection
Section "Monitor"
Option "DPMS" "false"
EndSection
# add end 18-09-30
### add at 18-10-02 centos7关于图形界面的处理
1 当安装了图形界面的情况处理
#查看开机启动模式为图形还是命令行
[root@nodchen ~]# systemctl get-default
graphical.target
#开机以命令行界面启动
[root@nodchen ~]# systemctl set-default multi-user.target
Removed symlink /etc/systemd/system/default.target.
Created symlink from /etc/systemd/system/default.target to /usr/lib/systemd/system/multi-user.target.
#开机以图形界面启动
systemctl set-default graphical.target
### add end 18-10-02
### add at 18-10-05 新增centos安装部署优化脚本
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 #------------------------------------------------------------------------------- 2 # 3 # 系统部署完毕后运行规范化脚本 4 # Author:nod 5 # Date:18-08-09 6 # $1 ip $2 gateway $3 hostname 7 # centOS 7.4 8 #------------------------------------------------------------------------------- 9 10 #------------------------------------------------------------------------------- 11 # 网卡优化 12 #------------------------------------------------------------------------------- 13 >/etc/sysconfig/network-scripts/ifcfg-eth0 14 cat >> /etc/sysconfig/network-scripts/ifcfg-eth0 <<EOF 15 TYPE=Ethernet 16 BOOTPROTO=none 17 NAME=eth0 18 DEVICE=eth0 19 ONBOOT=yes 20 IPADDR=$1 21 NETMASK=255.255.255.0 22 GATEWAY=$2 23 DNS1=223.5.5.5 24 EOF 25 26 27 28 #------------------------------------------------------------------------------- 29 # 关闭防火墙 30 #------------------------------------------------------------------------------- 31 systemctl disable firewalld.service 32 systemctl stop firewalld 33 setenforce 0 34 sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config 35 36 37 #------------------------------------------------------------------------------- 38 # 修改主机名 39 #------------------------------------------------------------------------------- 40 hostnamectl set-hostname $3 41 42 43 44 45 #------------------------------------------------------------------------------- 46 # yum优化 47 # 适用于阿里base+epel 48 #------------------------------------------------------------------------------- 49 curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo 50 51 yum -y install wget 52 53 wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo 54 systemctl stop NetworkManager.service 55 systemctl disable NetworkManager.service 56 yum install -y bash-completion.noarch 57 yum install -y net-tools vim lrzsz wget tree screen lsof tcpdump 58 systemctl stop postfix.service 59 systemctl disable postfix.service 60 61 #------------------------------------------------------------------------------- 62 # ssh优化 63 #------------------------------------------------------------------------------- 64 sed -i 's@#UseDNS no@UseDNS no@g' /etc/ssh/sshd_config 65 sed -i 's#GSSAPIAuthentication yes#GSSAPIAuthentication no#g' /etc/ssh/sshd_config 66 systemctl restart sshd 67 68 #------------------------------------------------------------------------------- 69 # 重启后检查 没问题就关机 至此部署完毕 70 #------------------------------------------------------------------------------- 71 reboot
### at end 18-10-05