用户创建
useradd/passwd
usermod
userdel
/etc/passwd 用户信息文件
/etc/shadow 用户密码文件,影子文件,密码是加密状态。
-u uid [-o] :设置用户的id号, -o表示去除用户ID号的唯一性
超级管理员的uid号为0,gid为0,工作目录为/root。
useradd -u 0 -o -g 0 -o gdlc
-g group:设置用户的初始组,相当于windows的users组。
[-G group,...]:设置用户的属于哪些组的成员。例如设置用户属于root、apache、bin组。
useradd -G root,apache,bin xyz
[root@client67 ~]# useradd -d /tmp/test1 -u 0 -o -c zhangsan -s /bin/csh test1
[root@client67 ~]# cat /etc/passwd|grep test1
test1:x:0:8892:zhangsan:/tmp/test1:/bin/csh
[root@client67 ~]# usermod -s /bin/ash test1
[root@client67 ~]# cat /etc/passwd|grep test1
test1:x:0:8892:zhangsan:/tmp/test1:/bin/ash
[root@client67 ~]# useradd -s /sbin/nologin test2
[root@client67 ~]# groupadd work1
[root@client67 ~]# usermod -G work1 test1
[root@client67 ~]# cat /etc/group|grep work1
work1:x:8894:test1
[root@client67 ~]#
二、创建批量用户脚本
[root@client67 ~]# cat user.sh
#!/bin/bash
for i in `seq 1 100`
do
if [ $1 = "add" ];then
useradd -s /bin/bash -d /home/user$i -g 100 user$i
echo 123456 |passwd --stdin user$i
fi
if [ $1 = "del" ];then
userdel -r user$i
fi
done
[root@client67 ~]#chmod +x user.sh
[root@client67 ~]#./user.sh add 创建用户
[root@client67 ~]#./user.sh del 删除用户
启动管理器: grub(主流)、lilo
/boot/grub/grub.conf c:\boot.ini ntdrl
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux AS (2.6.9-42.EL)
root (hd0,0)
hd0,0 设置引导分区的根。即为/boot
kernel /vmlinuz-2.6.9-42.EL ro root=LABEL=/1 rhgb quiet
root=LABEL=/1 表示系统的根分区,即为/.其中LABEL=/1表示根分区的标签,可以使用e2lable查看。
initrd /initrd-2.6.9-42.EL.img