The above error is given when I type lein into the command line in the home directory. For instance;

master@slave:~$ lein tutorial
bash: /usr/bin/lein: Permission denied

I downloaded the lein script and placed it in my downlods folder then ran the following commands.

master@slave:~$ cd /home/master/Downloads
master@slave:~/Downloads$ sudo scp lein /usr/bin/
[sudo] password for master: 
master@slave:~/Downloads$ sudo chmod a+x lein
master@slave:~/Downloads$ ./lein

After which the installation started with;

Downloading Leiningen to /home/master/.lein/self-installs/leiningen-2.5.3-standalone.jar now...

and proceeded without errors.

My java version is;

java version "1.7.0_79"

OpenJDK Runtime Environment (IcedTea 2.5.6) (7u79-2.5.6-0ubuntu1.14.04.1)

OpenJDK 64-Bit Server VM (build 24.79-b02, mixed mode)


your chmod changed the permissions on the copy in ~/Downloads. You need to set the executable bit on the copy in /usr/bin.

Also the ./lein is trying to run the file in ~/Downloads.

Try it in this order:

sudo cp ~/Downloads/lein /usr/bin # note cp, not scp, there's no need to use scp
sudo chmod +x /usr/bin/lein

Assuming lein is a valid runnable file, this should work.

| improve this answer | |
  • 1
    master@slave:/usr/bin$ chmod a+x lein -is what I needed – Jason Basanese Oct 23 '15 at 16:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.