首页 技术 正文
技术 2022年11月20日
0 收藏 728 点赞 4,889 浏览 3111 个字

要求:

  1. create vnc service for win7 access it via vnc viewer.
  2. 1TB disk for this Centos PC is used as Samba server, which used to share files. and nsn-intra user could access the folder via their personal win7 pc with map network drive.
  3. on this 1TB disk, create three folder with name: 1) “temp” 2) “pet_qcbak” 3) “pet_granny”
  4. on folder temp, the file rule is that delete the file after it was created 2 weeks later.
[root@localhost home]# rpm -qa | grep samba  已经安装的软件包,有些可以选择不安装
samba-libs-4.2.10-7.el7_2.x86_64
samba-4.2.10-7.el7_2.x86_64
samba-winbind-clients-4.2.10-7.el7_2.x86_64
samba-common-libs-4.2.10-7.el7_2.x86_64
samba-vfs-glusterfs-4.2.10-7.el7_2.x86_64
samba-common-4.2.10-7.el7_2.noarch
samba-test-libs-4.2.10-7.el7_2.x86_64
samba-winbind-modules-4.2.10-7.el7_2.x86_64
samba-pidl-4.2.10-7.el7_2.noarch
samba-winbind-krb5-locator-4.2.10-7.el7_2.x86_64
samba-client-4.2.10-7.el7_2.x86_64
samba-winbind-4.2.10-7.el7_2.x86_64
samba-dc-4.2.10-7.el7_2.x86_64
samba-devel-4.2.10-7.el7_2.x86_64
samba-client-libs-4.2.10-7.el7_2.x86_64
samba-dc-libs-4.2.10-7.el7_2.x86_64
samba-test-devel-4.2.10-7.el7_2.x86_64
samba-common-tools-4.2.10-7.el7_2.x86_64
samba-python-4.2.10-7.el7_2.x86_64
samba-test-4.2.10-7.el7_2.x86_64
[root@localhost home]# egrep -v "(^;|^#|^$)" /etc/samba/smb.conf   配置权限共享目录
[global]
workgroup = LinuxSir
server string = Linux Samba Server Sir
# log files split per-machine:
log file = /var/log/samba/log.%m
# maximum size of 50KB per log file, then rotate:
max log size = 50
security = user
passdb backend = tdbsam
# the following login script name is determined by the machine name
# (%m):
# the following login script name is determined by the UNIX user used:
# use an empty path to disable profile support:
# various scripts can be used on a domain controller or a stand-alone
# machine to add or delete corresponding UNIX accounts:
load printers = yes
cups options = raw
# obtain a list of printers automatically on UNIX System V systems:
[homes]
comment = Home Directories
browseable = no
writable = yes
[public]
comment = public
path = /sambadata
public = yes
writable = yes
[root@localhost home]# fdisk -l | grep sda//sda2作为共享硬盘
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
/dev/sda1 * 2048 1026047 512000 83 Linux
/dev/sda2 1026048 1953525167 976249560 83 Linux
[root@localhost home]# blkid /dev/sda2//获取uuid
/dev/sda2: UUID="1584f527-57d5-4d6e-a7f8-a29c6f069bdf" TYPE="xfs"
[root@localhost home]# cat /etc/fstab | grep "/sambadata"//实现开机自动挂载
UUID=1584f527-57d5-4d6e-a7f8-a29c6f069bdf /sambadata xfs defaults 0 0
[root@localhost home]#
[root@localhost ~]# mkdir -p /sambadata/{temp,pet_granny,pet_qcbak}   //新建共享文件夹
[root@localhost sambadata]# id samba //用户id
uid=1001(samba) gid=1001(samba) groups=1001(samba)
[root@localhost sambadata]# smbpasswd -a samba//转换系统用户为samba用户
New SMB password:
Retype new SMB password:
[root@localhost sambadata]# pdbedit -L //查看
samba:1001:!!!!!!!!!
请关闭防火墙
centos7
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
centos6.x
service iptables stop
chkconfig --del iptables
chkconfig iptables off请关闭selinux:
vim /etc/selinux/conf
SELINUX=disabled//修改为disabled
setenforce 0 //临时关闭
实现定期删出2周前的文件:[root@localhost sambadata]# vim /usr/local/bin/clear //添加执行脚本命令
#!/bin/bash
find /sambadata/temp/ -mtime +14 -name "*.*" -exec rm -rf {} \;
[root@localhost sambadata]# chmod +x /usr/local/bin/clear //执行权限
[root@localhost sambadata]# crontab -e//执行自动化删除任务
* 2 * * * /usr/local/bin/clear

测试:

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:8,965
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,486
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,331
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,114
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,747
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,781