大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。
Jetbrains全系列IDE使用 1年只要46元 售后保障 童叟无欺
要达到的目标:对公司的不同部门建立不同的文件共享,不同的用户访问同一个共享目录具有不同的权限.
-
安装samba
查看自己的服务器中是否安装了samba服务:
# rpm -aq|grep samba
没有直接运行以下命令:
# yum install samba samba-client samba-swat
运行后,依赖包(samba-common、samba-winbind-clients、libsmbclient)将直接自动安装. -
建用户,建共享文件夹并设置文件权限及归属
1> 添加用户:
[root@localhost samba]# useradd -s /sbin/nologin devadmin
[root@localhost samba]# useradd -s /sbin/nologin testadmin
[root@localhost samba]# useradd -s /sbin/nologin uiadmin
[root@localhost samba]# useradd -s /sbin/nologin hradmin
[root@localhost samba]# useradd -s /sbin/nologin prodadmin
[root@localhost samba]# useradd -s /sbin/nologin optsadmin
[root@localhost samba]# useradd -s /sbin/nologin admin
添加用户并设置用户所属组:
[root@localhost samba]# useradd -g devadmin -s /sbin/nologin d
[root@localhost samba]# useradd -g hradmin -s /sbin/nologin h
[root@localhost samba]# useradd -g prodadmin -s /sbin/nologin p
[root@localhost samba]# useradd -g optsadmin -s /sbin/nologin o2> 为用户设置samba密码: # smbpasswd -a devadmin New SMB password: Retype new SMB password: Added user devadmin. 3> 新建共享目录: # mkdir company # cd company # mkdir DEV TEST HR share # ll total 0 drwxr-xr-x 2 root root 6 Jun 30 14:26 DEV drwxr-xr-x 2 root root 6 Jun 30 14:26 HR drwxr-xr-x 2 root root 6 Jun 30 14:26 share drwxr-xr-x 2 root root 6 Jun 30 14:26 TEST 4> 设置项目权限: # chown devadmin.devadmin DEV/ && chown hradmin.hradmin HR && chown testadmin.testadmin TEST/ # ll total 0 drwxr-xr-x 2 devadmin devadmin 6 Jun 30 14:26 DEV drwxr-xr-x 2 hradmin hradmin 6 Jun 30 14:26 HR drwxr-xr-x 2 root root 6 Jun 30 14:26 share drwxr-xr-x 2 testadmin testadmin 6 Jun 30 14:26 TEST # chmod -R 0775 share/ # ll | grep share total 0 drwxrwxr-x 2 root root 6 Jun 30 14:26 share # cd share # mkdir DEV HR TEST Tools # chown devadmin.devadmin DEV/ && chown hradmin.hradmin HR && chown testadmin.testadmin TEST/ && chown admin.admin Tools/ # ll total 0 drwxr-xr-x 2 devadmin devadmin 6 Jun 30 14:52 DEV drwxr-xr-x 2 hradmin hradmin 6 Jun 30 14:52 HR drwxr-xr-x 2 testadmin testadmin 6 Jun 30 14:52 TEST drwxr-xr-x 2 admin admin 6 Jun 30 14:52 Tools # chmod 1770 DEV/ HR TEST/ # ll total 0 drwxrwx--T 2 devadmin devadmin 6 Jun 30 14:26 DEV drwxrwx--T 2 hradmin hradmin 6 Jun 30 14:26 HR drwxr-xr-x 2 admin admin 6 Jun 30 14:26 Tools drwxrwx--T 2 testadmin testadmin 6 Jun 30 14:26 TEST
-
配置samba
设置:
# ———————– Standalone Server Options ——————-
security = user
passdb backend = tdbsam
# ———————– Share Definitions ——————-
[DEV]
comment = This is a directory of Project.
path = /company/DEV/
public = no
admin users = devadmin
valid users = @devadmin
writable = yes
create mask = 0777
directory mask = 0775[TEST] comment = This is a directory of TEST. path = /company/TEST/ public = no admin users = testadmin valid users = @testadmin writable = yes create mask = 0750 directory mask = 0750 [HR] comment = This is a directory of HR. path = /company/HR/ public = no admin users = hradmin valid users = @hradmin writable = yes create mask = 0750 directory mask = 0750 [SHARE] comment = This is a share directory. path = /company/share/ public = no ;admin users = admin valid users = admin,@devadmin,@hradmin,@testadmin writable = yes create mask = 0755 directory mask = 0755
-
关闭,启动samba服务
# systemctl stop smb //关闭smb
# systemctl start smb //开启smb
# systemctl status smb //查看smb状态 - 设置samba开机重启:
# chkconfig smb on
参考链接:
http://blog.csdn.net/houqd2012/article/details/8880635
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/193455.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...