8

I'm trying to install Eclipse "by the book" in /opt, but when trying to access /opt, it seems that /opt directory doesn't exist in Ubuntu 14.04:

$ cd /opt/
bash: cd: /opt/: No such file or directory
$ ls -a /
.   bin   cdrom  etc   initrd.img      lib    lost+found  mnt   root  sbin  sys  usr  vmlinuz
..  boot  dev    home  initrd.img.old  lib64  media       proc  run   srv   tmp  var  vmlinuz.old

Why is the /opt folder missing? How to re-create one if applicable & what are the permissions to apply?

g0lem
  • 467

2 Answers2

7

I suggest mkdir --mode=755 /opt. Read/Write/Search for Owner (root:root), Read/Search for Group and Other. Allows root to create files/directories, allows anybody else to search and descend the directory tree under /opt (depending on lower nodes permissions)

waltinator
  • 36,399
6

Directory /opt is optional. It is not being used for anything in the standard Ubuntu distro so somebody decided not to create one.

Not a big deal. Just create it with sudo mkdir /opt

Edit

As suggested by waltinator a better command would be mkdir --mode=755 /opt

sмurf
  • 4,680
  • +1 While sudo mkdir --mode=755 /opt has the advantages of being very self-documenting and working the same way on another OS or on an Ubuntu system with unusual settings, I think the simpler sudo mkdir /opt should be considered equally fine. The default umask for root (as revealed by sudo -s umask) is 0022, so a directory created by running mkdir as root should have permissions 0755. See the answers at What is “umask” and how does it work? for details. – Eliah Kagan Apr 09 '15 at 02:12