sudo
安装 sudo
$ apt-get install sudo$ usermod debian -aG sudo
$ id debian
uid=1000(debian) gid=1000(debian) groups=1000(debian),24(cdrom),25(floppy),27(sudo),29(audio),30(dip),44(video),46(plugdev),109(netdev)root@debian:~# su - debian
debian@debian:~$ apt update
Reading package lists... Done
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock directory /var/lib/apt/lists/
W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied)
W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied)
debian@debian:~$ sudo apt update
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
[sudo] password for debian:
Get:1 http://ftp.debian.org/debian buster-backports InRelease [46.7 kB]
Hit:2 http://deb.debian.org/debian stable InRelease
Get:3 http://deb.debian.org/debian stable-updates InRelease [51.9 kB]
Get:4 http://ftp.debian.org/debian buster-backports/main Sources.diff/Index [27.8 kB]
Hit:5 http://deb.debian.org/debian-security stable/updates InRelease
Get:6 http://ftp.debian.org/debian buster-backports/main Sources 2021-01-12-1400.20.pdiff [1,057 B]
Get:6 http://ftp.debian.org/debian buster-backports/main Sources 2021-01-12-1400.20.pdiff [1,057 B]
Fetched 127 kB in 2s (76.4 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
16 packages can be upgraded. Run 'apt list --upgradable' to see them.配置 sudo
常见问题
执行 visudo 提示 command not found
禁用 root 用户
最后更新于