博客首页 注册 建议与交流 排行榜 加入友情链接
推荐 投诉 搜索: 帮助

做国内专业的Linux博客

追求完美Linux企业级解决方案-邮件服务器、ERP服务器、CRM服务器、HR服务器、CMS服务器、OA服务器、HA高可用、负载均衡、网格计算、入侵检测、性能优化、系统调优。
  gdlc.cublog.cn

关于作者
姓名:knight
职业:高级工程师/项目经理
位置:广东省linux中心
MSN :hsx918@hotmail.com
|| << >> ||
我的分类


周末班授课记录2-未整理
用户创建
   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

发表于: 2008-05-18,修改于: 2008-05-18 16:17,已浏览548次,有评论0条 推荐 投诉


网友评论
 发表评论