Samb共享用户的设置和修改Linux用户的id号,修改Linux组的id号,加入组,删除组成员等
零、samba帐号的设置
为samba共享添加用户,并设定仅能由授权用户进入的共享
#增加没有家目录,也无法登录系统的空用户
useradd -M userA -s /sbin/nologin
#-M 选项是--no-create-home的简写形式,即不为该用户配置家目录;-s选项,是为用户指定一个shell,这里指定的是 /sbin/nologin ,也就是无法登录。
#不需要为该类用户在系统上设置密码,但是要为其设定samba中的登录密码。#配置userA的samba登录密码
smbpasswd -a userA
New SMB password:
Retype new SMB password:
Added user userA.#配置一个非guest用户的共享
[Files]path = /home/filesguest only = no#自动检验配置是否有问题
testparmLoad smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[homes]"
Processing section "[printers]"
Processing section "[print$]"
Processing section "[Files]"
Loaded services file OK.
Server role: ROLE_STANDALONE
一、修改用户的id号
usermod -u 1001 UserA
二、修改组的id号
groupmod -g 1001 testgroup1
三、删除用户所在的附属组
其操作是从该附属组将用户删除
gpasswd -d UserA testgroup1
四、增加一个组
groupadd testgroup1 #增加了一个名为testgroup1的用户组
五、将现有用户添加到辅助组: -G
usermod -a -G testmygroup1,testgroup2 userA
六、更改用户的主要组: -g
usermod -g testgroup1 userA