6

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?

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

  • +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 9 '15 at 2:12
6

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)

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.