14 lines
317 B
Bash
14 lines
317 B
Bash
#!/bin/bash
|
||
|
||
# 创建组 testgroup
|
||
sudo groupadd testgroup
|
||
|
||
# 创建用户 testuser,-m 表示同时创建家目录
|
||
sudo useradd -m testuser
|
||
|
||
# 把 testuser 加入 testgroup,-a 表示追加、-G 表示附加组
|
||
sudo usermod -aG testgroup testuser
|
||
|
||
# 验证:看 testuser 是否已经在 testgroup 里
|
||
id testuser
|