2

I am trying to understand something that might be very simple for a lot of you but is quite puzzling from me as a daily Windows user.

I am following the docker installation on Mac OS X.

One of the steps is:

$ chmod +x boot2docker

The next step is using boot2docker like this:

$ boot2docker init

However this does not work for me. What works is:

 $ ./boot2docker init

So the tutorial assumes that I need to implicitly run with ./ or is there a way in bash to avoid typing that and execute something?

migrated from serverfault.com May 30 '14 at 13:44

This question came from our site for system and network administrators.

8

The difference is that Windows implicitly has . in the path, which is something it inherited from DOS, which always was a single user system.

Mac OS X is build on Unix, which is a multi user system. And for security reasons it does not have . implicitly in the path.

When . is not in the path, then to run a command in the current directory, one has to prefix the command with ./ in order to explicitly tell the shell, that you want to run a command in the current directory. The ./ notation will work with or without . in the path. If you remove ./ it will only work if . is in the path. For that reason documentation will usually include the ./ part.

What is the security implication of including . in the path?

Let's say that you have typed cd ~joker to enter joker's home directory. Next you type ls to see what files are there. If . was at the beginning of the path, then joker could have a script in his home directory called ls, which could do anything to your user account.

If . was the last entry in the path, it wouldn't go so bad. In the previous scenario, you would run the real ls command instead of the one joker had in his home directory. But you might mistype the ls command. Your fingers might slip, and you typed ks. Then ks might not be found any of the preceding directories, but finally as the shell got to . it might find a ks command in joker's home directory.

  • Ok so the tutorial from docker not using ./is not best thing for beginners :) – Cris May 29 '14 at 11:04
  • 2
    @Cris Either that or they should have mentioned adding the newly created bin directory to PATH, if that is what they had in mind. – Håkan Lindqvist May 29 '14 at 15:06

Your Answer

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