apt install 警告 .dpkg.cfg 讀取:權限被拒絕

apt install 警告 .dpkg.cfg 讀取:權限被拒絕

我的設定如下:我的使用者透過網路驗證登錄,其 home 已安裝 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 使用 sudo 在 root 上下文中運行,並且無法存取主目錄。這是一個煩人但無害的警告,可以忽略。

答案3

有時,安裝看起來好像不是用戶,而是程式正在請求權限。

chmod 777 違規資料夾名稱

這將使所有用戶都可以讀、寫和執行。如果這解決了問題,您可能可以更深入地研究並出於網路安全原因解決問題。

相關內容