ubuntu新建用户

ubuntu新建⽤户
ubuntu初始环境只有root⽤户,为了安全,新建⼀般权限⽤户。
1. 添加⽤户名为test
root@iZbp10p2g1civut:/# useradd test
2. 为test⽤户创建密码,输⼊该命令后会输⼊密码,和密码确认
root@iZbp10p2g1civut:/# passwd test
妈妈的恶作剧3. 为test⽤户指定命令解释程序(通常为/bin/bash)
第六次人口普查意见领袖root@iZbp10p2g1civut:/# usermod -s /bin/bash test
4. 为test⽤户指定⽤户主⽬录
root@iZbp10p2g1civut:/# usermod -d /home/csdn test
5. 创建test⽤户主⽬录⽂件夹
root@iZbp10p2g1civut:/#  mkdir /home/test
6. 把test⽂件夹所有权赋给test⽤户
正二十面体root@iZbp10p2g1civut:/#  chown -R test:test /home/test
此时创建⽤户已经成功,可以⽤test⽤户进⾏登录。但此时的test⽤户不能使⽤sudo命令,因为没有在/etc/sudoers⽂件⾥给test⽤户添加权限。
此时切换到root⽤户下,在/etc/sudoers⽂件中添加⼀⾏命令:test ALL=(ALL) ALL。
注:纳米医药
2.%test ALL=(ALL) ALL                            // 允许⽤户组youuser⾥⾯的⽤户执⾏sudo命令(需要输⼊密码)
中国人民解放军第四军医大学
4.%test ALL=(ALL) NOPASSWD: ALL    // 允许⽤户组youuser⾥⾯的⽤户执⾏sudo命令,并且在执⾏的时候不输⼊密码

本文发布于:2024-09-21 18:55:07,感谢您对本站的认可!

本文链接:https://www.17tex.com/xueshu/479564.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:密码   命令   意见   添加
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2024 Comsenz Inc.Powered by © 易纺专利技术学习网 豫ICP备2022007602号 豫公网安备41160202000603 站长QQ:729038198 关于我们 投诉建议