Package Could not Accessed by User '_apt' Due to Permission Denied

APPLIES TO

Operating System - Ubuntu 22.04.3 LTS

SYMPTOMS

Package could not accessed by user '_apt' due to permission denied.

jove@ubuntu:~/Downloads]$ sudo apt install ./baidunetdisk_4.17.7_amd64.deb
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'baidunetdisk' instead of './baidunetdisk_4.17.7_amd64.deb'
The following packages were automatically installed and are no longer required:
libflashrom1 libftdi1-2 libllvm13
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
baidunetdisk
0 upgraded, 1 newly installed, 0 to remove and 5 not upgraded.
Need to get 0 B/104 MB of archives.
After this operation, 380 MB of additional disk space will be used.
Get:1 /home/jove/Downloads/baidunetdisk_4.17.7_amd64.deb baidunetdisk amd64 4.17.7 [104 MB]
Selecting previously unselected package baidunetdisk.
(Reading database ... 205691 files and directories currently installed.)
Preparing to unpack .../baidunetdisk_4.17.7_amd64.deb ...
Unpacking baidunetdisk (4.17.7) ...
Setting up baidunetdisk (4.17.7) ...
Processing triggers for desktop-file-utils (0.26-1ubuntu3) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu3) ...
Processing triggers for mailcap (3.70+nmu1ubuntu1) ...
N: Download is performed unsandboxed as root as file '/home/jove/Downloads/baidunetdisk_4.17.7_amd64.deb' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)

CAUSE

This is often due to the fact that the /home/user/Downloads folder is by-default non-readable by others.

jove@ubuntu:~/Downloads]$ ls -ld /home/jove
drwxr-x--- 18 jove jove 4096 8月 20 17:59 /home/jove

SOLUTION

Just move deb package to /tmp for example, and install from there you will get rid of that warning.

jove@ubuntu:~/Downloads]$ mv baidunetdisk_4.17.7_amd64.deb /tmp/
jove@ubuntu:~/Downloads]$ sudo apt install /tmp/baidunetdisk_4.17.7_amd64.deb