ubuntu新建⽤户
ubuntu初始环境只有root⽤户,为了安全,新建⼀般权限⽤户。
root@iZbp10p2g1civut:/# useradd test
2. 为test⽤户创建密码,输⼊该命令后会输⼊密码,和密码确认 root@iZbp10p2g1civut:/# passwd test
妈妈的恶作剧3. 为test⽤户指定命令解释程序(通常为/bin/bash)
第六次人口普查
意见领袖root@iZbp10p2g1civut:/# usermod -s /bin/bash test4. 为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命令,并且在执⾏的时候不输⼊密码