我正在尝试从 Source Forge 网站上传/安装开放 VPN(免费)。按照说明进行复制/粘贴,但收到以下内容:
graeme@graeme-ThinkCentre:~$ apt update && apt -y install ca-certificates wget net-tools
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)
graeme@graeme-ThinkCentre:~$ wget -qO - https://as-repository.openvpn.net/as-repo-public.gpg | apt-key add -
E: This command can only be used by root.
graeme@graeme-ThinkCentre:~$ echo "deb http://as-repository.openvpn.net/as/debian bionic main">/etc/apt/sources.list.d/openvpn-as-repo.list
bash: /etc/apt/sources.list.d/openvpn-as-repo.list: Permission denied
graeme@graeme-ThinkCentre:~$ apt update && apt -y install openvpn-as
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)
graeme@graeme-ThinkCentre:~$
答案1
您需要使用sudo
运行apt
命令来允许权限。
例如,您应该运行这个:
sudo apt update && sudo apt -y install ca-certificates wget net-tools
wget -qO - https://as-repository.openvpn.net/as-repo-public.gpg | sudo apt-key add -
此外,当您尝试使用sudo
withecho
写入需要额外权限才能写入的文件时,您会遇到权限问题。您可以通过管道echo
to 来规避此问题sudo tee
,如下所示:
echo "deb http://as-repository.openvpn.net/as/debian bionic main" | sudo tee -a /etc/apt/sources.list.d/openvpn-as-repo.list