这篇文章将为大家详细讲解有关deepin系统如何创建Sudo用户,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。
deepin是由武汉深之度科技有限公司在Debian基础上开发的Linux操作系统,其前身是Hiweed Linux操作系统,于2004年2月28日开始对外发行,可以安装在个人计算机和服务器中。
Deepin 15.11
使用adduser创建一个用户,用户名为user01
bob@bob-PC:~$ sudo adduser user01 Adding user `user01' ... Adding new group `user01' (1001) ... Adding new user `user01' (1001) with group `user01' ... Creating home directory `/home/user01' ... Copying files from `/etc/skel' ... Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully Changing the user information for user01 Enter the new value, or press ENTER for the default Full Name []: user01 Room Number []: Work Phone []: Home Phone []: Other []: Is the information correct? [Y/n] Y
sudo组的所有成员都在Deepin系统上授予sudo和root访问权限。因此,要将刚刚创建的user01用户添加到sudo组,请运行以下命令:
bob@bob-PC:~$ sudo adduser user01 sudo Adding user `user01' to group `sudo' ... Adding user user01 to group sudo Done.
使用id命令查看一下用户是否添加到sudo组了
bob@bob-PC:~$ id user01 uid=1001(user01) gid=1001(user01) groups=1001(user01),27(sudo)
现在user01用户使用ssh登录到本机测试
bob@bob-PC:~$ ssh user01@localhost The authenticity of host 'localhost (127.0.0.1)' can't be established. ECDSA key fingerprint is SHA256:TKkqZwt9OzPaVSwSkFoLXtAFwnU4aKMG7T8QyF2fPKw. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'localhost' (ECDSA) to the list of known hosts. user01@localhost's password: Welcome to Deepin 15.11 GNU/Linux * Homepage:https://www.deepin.org/ * Bugreport:https://feedback.deepin.org/feedback/ * Community:https://bbs.deepin.org/ user01@bob-PC:~$
检验一下sudo是否好用:
user01@bob-PC:~$ ls -l /root ls: cannot open directory '/root': Permission denied user01@bob-PC:~$ sudo ls -l /root [sudo] password for user01: total 4 drwxr-xr-x 2 root root 4096 Mar 6 18:05 模板
使用例子:
sudo [option] command sudo -i sudo -s sudo systemctl restart networking sudo tail -f /var/log/boot.log
user01@bob-PC:~$ sudo deluser user01 sudo Removing user `user01' from group `sudo' ... Done.# 查看一下用户是否不在sudo组里面了user01@bob-PC:~$ id user01 uid=1001(user01) gid=1001(user01) groups=1001(user01)
如何删除一个用户:
bob@bob-PC:~$ sudo deluser --remove-home user01 Looking for files to backup/remove ... Removing files ... Removing user `user01' ... Warning: group `user01' has no more members. Done.
关于“deepin系统如何创建Sudo用户”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。