1,查询用户所属组
groups 用户名
2,修改用户所属组
usermod -g 用户组 用户名
3,添加只读用户,授权指定命令
# 创建用户组
groupadd 组名
# 添加用户
useradd -g 组名 用户
# 添加密码
passwd 用户
# 修文件权限
chown root. /home/用户/.bash_profile
chmod 755 /home/用户/.bash_profile
# 创建文件夹
mkdir /home/用户/.bin
# 修改文件/home/用户/.bash_profile, 末尾新增
...
PATH=$HOME/.bin
export PATH
# 授权命令
# cd,echo,source 等命令不需要授权
ln -s /bin/cat /home/用户/.bin/cat
ln -s /usr/bin/tail /home/用户/.bin/tail
ln -s /bin/more /home/用户/.bin/more
ln -s /bin/cat /home/用户/.bin/cat
ln -s /bin/grep /home/用户/.bin/grep
ln -s /bin/pwd /home/用户/.bin/pwd
ln -s /bin/ls /home/用户/.bin/ls
ln -s /bin/tar /home/用户/.bin/tar
ln -s /bin/ps /home/用户/.bin/ps
# 切换到 用户
su 用户
# 生效文件
source /home/用户/.bash_profile