溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

deepin系統(tǒng)如何創(chuàng)建Sudo用戶

發(fā)布時(shí)間:2022-02-19 09:28:20 來(lái)源:億速云 閱讀:232 作者:小新 欄目:開(kāi)發(fā)技術(shù)

這篇文章將為大家詳細(xì)講解有關(guān)deepin系統(tǒng)如何創(chuàng)建Sudo用戶,小編覺(jué)得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。

deepin是由武漢深之度科技有限公司在Debian基礎(chǔ)上開(kāi)發(fā)的Linux操作系統(tǒng),其前身是Hiweed Linux操作系統(tǒng),于2004年2月28日開(kāi)始對(duì)外發(fā)行,可以安裝在個(gè)人計(jì)算機(jī)和服務(wù)器中。

deepin系統(tǒng)如何創(chuàng)建Sudo用戶

環(huán)境

Deepin 15.11

創(chuàng)建一個(gè)新用戶

使用adduser創(chuàng)建一個(gè)用戶,用戶名為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
deepin系統(tǒng)如何創(chuàng)建Sudo用戶
如何在Deepin 15.11中創(chuàng)建Sudo用戶如何在Deepin 15.11中創(chuàng)建Sudo用戶

添加user01這個(gè)用戶到sudo組里面

sudo組的所有成員都在Deepin系統(tǒng)上授予sudo和root訪問(wèn)權(quán)限。因此,要將剛剛創(chuàng)建的user01用戶添加到sudo組,請(qǐng)運(yùn)行以下命令:

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)

測(cè)試sudo用戶賬號(hào)

現(xiàn)在user01用戶使用ssh登錄到本機(jī)測(cè)試

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:~$

檢驗(yàn)一下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 模板
deepin系統(tǒng)如何創(chuàng)建Sudo用戶
如何在Deepin 15.11中創(chuàng)建Sudo用戶如何在Deepin 15.11中創(chuàng)建Sudo用戶

如何使用sudo執(zhí)行命令

使用例子:

 sudo [option] command sudo -i
 sudo -s
 sudo systemctl restart networking
 sudo tail -f /var/log/boot.log

如何從sudo組里刪掉指定的用戶

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)

如何刪除一個(gè)用戶:

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.

關(guān)于“deepin系統(tǒng)如何創(chuàng)建Sudo用戶”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,使各位可以學(xué)到更多知識(shí),如果覺(jué)得文章不錯(cuò),請(qǐng)把它分享出去讓更多的人看到。

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI