无法运行进入权限被拒绝吗?

david@raspberrypi:~ $ go env

-bash: /usr/bin/go: Permission denied

this is my bash.rc

export GOPATH=$HOME/go

$HOME/.bashrc 

export PATH=$PATH:$GOROOT/bin:$GOPATH/bin

if i run ls-lah in my david@raspberry pi, i get the following:

david@raspberrypi:~ $ ls -lah 
total 28K 
drwxr-xr-x 3 david david 4.0K Mar  2 22:20 . 
drwxr-xr-x 4 root  root  4.0K Mar  2 20:03 ..
-rw------- 1 david david 3.1K Mar  2 21:48 .bash_history
-rw-r--r-- 1 david david  220 Mar  2 20:03 .bash_logout
-rw-r--r-- 1 david david 3.6K Mar  2 22:15 .bashrc 
lrwxrwxrwx 1 david root    11 Mar  2 21:31 go -> /usr/lib/go 
drwxr-xr-x 2 david david 4.0K Mar  2 20:25 .nano
-rw-r--r-- 1 david david  675 Mar  2 20:03 .profile

I am assuming that the user you're logged in as doesn't have permissions to run go.

To find that out, run the following

$ which go
/usr/local/go/bin/go

$ ls -l $(which go)
-rwxr-xr-x  1 root  wheel  12896684 Jan 24 01:28 /usr/local/go/bin/go

From the above we know that the owner is root and group owner is wheel.

Now run echo $USER to see if who is logged in user.

Since you're getting permission denied to run go as $USER, you may want to add the user into the group mentioned in ls -l. So, run the below.

$ usermod -aG $USER wheel

And reboot the system! Then try go env again to see if it works.

-a is for append -G is for which groups to append

usermod docs

Remember wheel is the group owner that I got while running ls -l. Yours might be different. This usermod command is for ubuntu. In your case, it is raspberry pi so raspbian OS. Find out the correct options as it changes from OS to OS.