'Permision denied for dotnet

I recently installed dotnet 5.0 on Pop OS but whenever I try to use it it says that I don't have permission.

For example, if I just try to run the command dotnet it gives the the message

cannot snap-exec: cannot exec "/snap/dotnet-sdk/144/snap/command-chain/snapcraft-runner": permission denied

When I run the command as the root user it works perfectly fine.

I don't know if this is because I installed dotnet as a snap package



Solution 1:[1]

I had the same issue and unfortunately the dotnet issue page was not working.

To fix this issue I had to install the package with apt instead of snap.

sudo snap remove dotnet-sdk // if needed

wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb

sudo dpkg -i packages-microsoft-prod.deb

sudo apt update

sudo apt install apt-transport-https

sudo apt-get install -y dotnet-sdk-5.0

Solution 2:[2]

Remove snap first sudo snap remove dotnet-sdk
Manually download Dotnet SDK https://dotnet.microsoft.com/en-us/download/dotnet/6.0

When your download completes, open the terminal and run the following commands to extract the SDK to make the commands available at the terminal.

mkdir -p $HOME/dotnet && tar zxf dotnet-sdk-6.0.101-linux-x64.tar.gz -C $HOME/dotnet
export DOTNET_ROOT=$HOME/dotnet
export PATH=$PATH:$HOME/dotnet

one last thing Edit shell profile to permanently

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 StPaulis
Solution 2