8.01 用户组和权限管理练习

发布时间:2020-06-16 09:16:49 作者:power小小潘
来源:网络 阅读:407

1、创建用户gentoo,附加组为bin和root,默认shell为/bin/csh,注释信息为“Gentoo Distribution”

    useradd -G bin,root -s /bin/csh -c "gentoo distribution" gentoo


2、创建下面用户,组和成员关系,名字为admins的组,用户natasha,使用admins作为附加组,用户harry,也使用admins,作为附加组,用户sarah,不可交互登陆系统,且不是admins成员,natasha,harry,sarah密码都是centos

   groupadd admins

    useradd -G admins natasha

    useradd -G admins harry

    useradd -s /sbin/nologin sarah

    echo centos | passwd --stdin natasha

    echo centos | passwd --stdin harry

    echo centos | passwd --stdin sarah


3、创建testuser uid 1234,主组:bin,辅助组:root,ftp,shell:/bin/csh home:/testdir/testuser

    useradd -u 1234 -g bin -G root,ftp -s /bin/csh -d /testdir/testuser testuser


4、修改testuser uid:4321,主组:root,辅助组:nobody,loginname:test,home:/home/test 家数据迁移

    groupadd loginname

    usermod -u 4321 -g root -G nobody -l test -dm /home/test testuser


5、批量创建帐号:user1...user10,uid:3000-3009,shell:/bin/csh,home:/testdir/username

passwd:usernamepass,注意家目录相关配置,使用户正常登录

    vim useradd.txt     

        user1:x:3000:3000::/testdir/username1:/bin/csh

        user2:x:3001:3001::/testdir/username2:/bin/csh

        user3:x:3002:3002::/testdir/username3:/bin/csh

        user4:x:3003:3003::/testdir/username4:/bin/csh

        user5:x:3004:3004::/testdir/username5:/bin/csh

        user6:x:3005:3005::/testdir/username6:/bin/csh

        user7:x:3006:3006::/testdir/username7:/bin/csh

        user8:x:3007:3007::/testdir/username8:/bin/csh

        user9:x:3008:3008::/testdir/username9:/bin/csh

    newusers useradd.txt

    vim pwd.txt     

        user1:123456

        user2:123456

        user3:123456

        user4:123456

        user5:123456

        user6:123456

        user7:123456

        user8:123456

        user9:123456

    cat pwd.txt | chpasswd

        


推荐阅读:
  1. android fragment中代码添加OptionsMenu
  2. 判断浏览器内核和终端

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

练习

上一篇: org.apache.hadoop.hbase.Pleas

下一篇:js中使用split分割字符串的方法

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》