apt install 警告 .dpkg.cfg 读取:权限被拒绝

apt install 警告 .dpkg.cfg 读取:权限被拒绝

我的设置如下:我的用户通过网络身份验证登录,其主目录已安装 NFS(所有这些都在 ubuntu 16.04 上)。

我正在尝试设置我的机器,以便运行多个apt命令,updateinstall

  • update失败E: Unable to change to /home/$user/ - chdir (13: Permission denied)。我设法用这个答案, 基本上cd /

  • install警告我:dpkg: warning: failed to open configuration file '/home/zr258722/.dpkg.cfg' for reading: Permission denied

我应该如何消除这些错误/警告?


编辑

我正在运行的确切命令及其输出是:

  • sudo apt-get update这使:
Ign:1 http://$intranet/depots/infogerance/ubuntu/drf-i2bm_pilote xenial-security InRelease
Ign:2 http://$intranet/depots/infogerance/ubuntu/drf-i2bm_pilote xenial-updates InRelease
Ign:3 http://$intranet/depots/infogerance/ubuntu/drf-i2bm_pilote xenial InRelease
Ign:4 http://$intranet/depots/infogerance/ubuntu/saclay_pilote xenial-security InRelease
Ign:5 http://$intranet/depots/infogerance/ubuntu/saclay_pilote xenial-updates InRelease
Ign:6 http://$intranet/depots/infogerance/ubuntu/saclay_pilote xenial InRelease
Ign:7 http://$intranet/depots/neurodebian/current data InRelease            
Ign:8 http://$intranet/depots/neurodebian/current xenial InRelease                                                             
Ign:9 http://$intranet/depots/ubuntu/current xenial-security InRelease                                                         
Ign:10 http://$intranet/depots/ubuntu/current xenial-updates InRelease                                                         
Ign:11 http://dl.google.com/linux/chrome/deb stable InRelease                                                                           
Ign:12 http://$intranet/depots/ubuntu/current xenial InRelease                                                                 
Hit:13 http://$intranet/depots/infogerance/ubuntu/drf-i2bm_pilote xenial-security Release                
Hit:14 http://$intranet/depots/infogerance/ubuntu/drf-i2bm_pilote xenial-updates Release                                       
Hit:15 http://$intranet/depots/infogerance/ubuntu/drf-i2bm_pilote xenial Release                                               
Hit:16 http://$intranet/depots/infogerance/ubuntu/saclay_pilote xenial-security Release                                        
Hit:17 http://$intranet/depots/infogerance/ubuntu/saclay_pilote xenial-updates Release                                         
Hit:18 http://$intranet/depots/infogerance/ubuntu/saclay_pilote xenial Release                                                 
Hit:19 http://$intranet/depots/neurodebian/current data Release                                                                
Hit:20 http://$intranet/depots/neurodebian/current xenial Release                                                              
Hit:21 http://$intranet/depots/ubuntu/current xenial-security Release                                                          
Hit:22 http://$intranet/depots/ubuntu/current xenial-updates Release                                                           
Hit:23 http://$intranet/depots/ubuntu/current xenial Release                                                                
Hit:24 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial InRelease                                   
Hit:25 http://dl.google.com/linux/chrome/deb stable Release                                                    
Hit:26 http://ppa.launchpad.net/webupd8team/atom/ubuntu xenial InRelease
Hit:28 http://repository.spotify.com stable InRelease                   
Reading package lists... Done                     
E: Unable to change to /home/$user/ - chdir (13: Permission denied)


  • 例如sudo apt-get python3.6

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libpython3-dev libpython3.5-dev libpython3.6 libpython3.6-dev python3.5-dev
Use 'sudo apt autoremove' to remove them.
Suggested packages:
  python3.6-venv python3.6-doc
The following NEW packages will be installed:
  python3.6
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/246 kB of archives.
After this operation, 336 kB of additional disk space will be used.
dpkg: warning: failed to open configuration file '/home/$user/.dpkg.cfg' for reading: Permission denied
Selecting previously unselected package python3.6.
(Reading database ... 375863 files and directories currently installed.)
Preparing to unpack .../python3.6_3.6.8-1~16.04.york1_amd64.deb ...
Unpacking python3.6 (3.6.8-1~16.04.york1) ...
Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20180209-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) ...
Processing triggers for desktop-file-utils (0.22-1ubuntu5.2) ...
Processing triggers for mime-support (3.59ubuntu1) ...
Processing triggers for man-db (2.7.5-1) ...
dpkg: warning: failed to open configuration file '/home/$user/.dpkg.cfg' for reading: Permission denied
Setting up python3.6 (3.6.8-1~16.04.york1) ...
dpkg: warning: failed to open configuration file '/home/$user/.dpkg.cfg' for reading: Permission denied
dpkg: warning: failed to open configuration file '/home/$user/.dpkg.cfg' for reading: Permission denied

答案1

您的主文件夹至少应具有以下权限:u=rwx,g=r,o=r,运行chmod 0711 /home/$user

答案2

通常,root 没有权限访问 NFS 挂载,除非为导出设置了 no_root_squash,否则 apt-get 会在 root 上下文中使用 sudo 运行,无法访问主目录。这是一个烦人但无害的警告,可以忽略。

答案3

有时安装时看起来好像不是用户而是程序在请求权限。您可以尝试将有问题的文件夹的权限更改为

chmod 777 offending_foldername

这将使所有用户都具有读取、写入和执行权限。如果这解决了问题,那么您可能会更深入地研究并出于网络安全原因修复该问题。

相关内容