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.
提示输入密码时,输入当前用户 ( debian ) 的密码。
配置 sudo
sudo 的配置可以使用 sudo -ll 查看,使用 sudo -lU 查看特定用户的配置
debian@debian:~$ sudo -ll
Matching Defaults entries for debian on debian:
env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin
User debian may run the following commands on debian:
Sudoers entry:
RunAsUsers: ALL
RunAsGroups: ALL
Commands:
ALL
debian@debian:~$ sudo -lU debian
Matching Defaults entries for debian on debian:
env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin
User debian may run the following commands on debian:
(ALL : ALL) ALL