sudo apt-get update 出现 403 错误

sudo apt-get update 出现 403 错误

几个月来我一直不明白为什么我无法更新,所以我就不管它了。

后来有一天,当我在 Windows 电脑上安装 Ubuntu 桌面时,我遇到了同样的问题。我的 Linux 和 Windows 电脑都通过以太网线连接到互联网。所以我在另一台电脑上也遇到了同样的错误,这让我认为这是一个 IP 问题。所以我将我的连接(在我的 Windows 上)从以太网切换到 wifi,然后就好了。

不幸的是,我的 Linux 上没有 wifi 适配器。它也不允许我安装。

为什么我通过 wifi 连接时可以 sudo apt-get update,但通过以太网连接时却不行?

来源列表

deb http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse

deb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse

deb http://archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse

deb http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse

deb http://archive.canonical.com/ubuntu focal partner
deb-src http://archive.canonical.com/ubuntu focal partner

错误:

Err:1 http://packages.ros.org/ros/ubuntu focal InRelease
  403  Forbidden: header 'Content-Type' value denied [IP: 140.211.166.134 80]
Hit:2 http://packages.microsoft.com/repos/code stable InRelease                                       
Err:3 http://security.ubuntu.com/ubuntu focal-security InRelease                                      
  403  Forbidden: header 'Content-Type' value denied [IP: 91.189.91.38 80]
Hit:4 https://packages.microsoft.com/ubuntu/20.04/prod focal InRelease                                
Err:5 http://ppa.launchpad.net/apandada1/brightness-controller/ubuntu focal InRelease                 
  403  Forbidden: header 'Content-Type' value denied [IP: 91.189.95.85 80]
Err:6 http://archive.ubuntu.com/ubuntu focal InRelease                                         
  403  Forbidden: header 'Content-Type' value denied [IP: 91.189.88.152 80]
Hit:7 https://dl.google.com/linux/chrome/deb stable InRelease                                    
Err:8 http://ppa.launchpad.net/otto-kesselgulasch/gimp/ubuntu focal InRelease
  403  Forbidden: header 'Content-Type' value denied [IP: 91.189.95.85 80]
Err:9 http://archive.ubuntu.com/ubuntu focal-updates InRelease           
  403  Forbidden: header 'Content-Type' value denied [IP: 91.189.88.152 80]
Err:10 http://ppa.launchpad.net/rock-core/qt4/ubuntu focal InRelease     
  403  Forbidden: header 'Content-Type' value denied [IP: 91.189.95.85 80]
Reading package lists... Done
N: See apt-secure(8) manpage for repository creation and user configuration details.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
E: The repository 'http://packages.ros.org/ros/ubuntu focal InRelease' is not signed.
E: Failed to fetch http://packages.ros.org/ros/ubuntu/dists/focal/InRelease  403  Forbidden: header 'Content-Type' value denied [IP: 140.211.166.134 80]
N: See apt-secure(8) manpage for repository creation and user configuration details.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
E: The repository 'http://security.ubuntu.com/ubuntu focal-security InRelease' is not signed.
E: Failed to fetch http://security.ubuntu.com/ubuntu/dists/focal-security/InRelease  403  Forbidden: header 'Content-Type' value denied [IP: 91.189.91.38 80]
N: See apt-secure(8) manpage for repository creation and user configuration details.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
E: The repository 'http://ppa.launchpad.net/apandada1/brightness-controller/ubuntu focal InRelease' is not signed.
E: Failed to fetch http://ppa.launchpad.net/apandada1/brightness-controller/ubuntu/dists/focal/InRelease  403  Forbidden: header 'Content-Type' value denied [IP: 91.189.95.85 80]
N: See apt-secure(8) manpage for repository creation and user configuration details.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
E: The repository 'http://archive.ubuntu.com/ubuntu focal InRelease' is not signed.
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal/InRelease  403  Forbidden: header 'Content-Type' value denied [IP: 91.189.88.152 80]
N: See apt-secure(8) manpage for repository creation and user configuration details.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
E: The repository 'http://ppa.launchpad.net/otto-kesselgulasch/gimp/ubuntu focal InRelease' is not signed.
E: Failed to fetch http://ppa.launchpad.net/otto-kesselgulasch/gimp/ubuntu/dists/focal/InRelease  403  Forbidden: header 'Content-Type' value denied [IP: 91.189.95.85 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-updates/InRelease  403  Forbidden: header 'Content-Type' value denied [IP: 91.189.88.152 80]
E: The repository 'http://archive.ubuntu.com/ubuntu focal-updates InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Failed to fetch http://ppa.launchpad.net/rock-core/qt4/ubuntu/dists/focal/InRelease  403  Forbidden: header 'Content-Type' value denied [IP: 91.189.95.85 80]
E: The repository 'http://ppa.launchpad.net/rock-core/qt4/ubuntu focal InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

答案1

听起来你遇到了一个问题,以太网配置为限制性的,过滤了所有的流量并禁止流量到不允许的目的地。

这意味着要么是 Web 代理正在发挥作用,要么是以太网网络受到限制。

不幸的是,正如你在评论中回复我的询问时所说,你谈论的是工作场所网络,因此你不能只是将设备插入公司网络并期望它能正常工作。 (恰当的) 工作场所网络安全不是那样运作的,wifi 很可能连接到与公司内容隔离的访客网络,而不是公司以太网,因为公司以太网对可以访问或不能访问的内容有更多的控制权(例如访问互联网,因此由于您的设备不允许外出,因此会立即设置 403 限制;自带设备的概念有助于拥有与公司项目隔离的 wifi 网络,因此您无法直接从 wifi 访问公司,而是必须遍历互联网,然后通过单独的 IP 和连接返回到工作电子邮件等,同样,公司也无法访问 wifi 上的设备。)。

仅有的这里的解决方案可以让您不违反公司使用政策(并且您的网络上很可能存在可接受使用政策),就是与您工作场所的 IT 团队进行交谈 - 由于业务/公司网络的构建方式,他们是唯一可以提供帮助的人 - 您雇主的 IT 团队和安全团队掌握着钥匙,所以只有他们可以帮助您。

(不过,他们很可能不会以对您有效的方式让他们无法控制的设备进入以太网网络 - 这是大多数拥有安全团队的企业的典型 IT 安全政策。)

答案2

这为我修复了这个问题:

sed -i s/http/ftp/ /etc/apt/sources.list && apt-get update

http被禁止,但ftp被允许,从而建立与存储库的连接。这可能从 Ubuntu 端受到限制。我不需要在我这边做任何事情,没有运行防火墙或限制。

相关内容