Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to access my /opt/ folder. I have found the following commands for giving access permission.

I am not sure what is the purpose of this commands, which one is the better to use it to maintain security and access permission both.

I want to understand the number system within this command.

sudo chmod 755 -R /opt/

sudo chmod 755 /opt/

sudo chmod 775 /opt/

sudo chmod 777 /opt/

I didn't know these commands, so what I use to do previously was gksudo nautilius then:

Right click > change the owner from root to current user group

Now I have found the chmod command I would like to better understand how this command works and how best to implement it.

share|improve this question

migrated from stackoverflow.com Aug 12 '12 at 13:22

This question came from our site for professional and enthusiast programmers.

2  
did you try man chmod ? or simply google: chmod – alfasin Aug 11 '12 at 4:05
    
@alfasin : No i have not ....wait i will try – user1201239 Aug 11 '12 at 4:09
1  
These commands are absolutely the wrong solution. The proper solution is to use sudo for the operations which require administrator privileges. If you don't have sudo access, obtain it. – tripleee Aug 11 '12 at 15:54
    
@tripleee : I am learning commands as I am going in deeper with ubuntu ..found it amazing to use !!! have started looking in to help documentation of ubuntu... hope i will make it soon – user1201239 Aug 11 '12 at 17:49

The positions about numbers is in this way:

  • first position -> permisions for the Owner (current user)
  • second position -> permisions for the Group (set by owner)
  • third position -> permisions for anyone else

So the numbers means:

0 – no permission, this person cannot read, write or execute
1 – execute only
2 – write only
3 – execute and write only (1 + 2)
4 – read only
5 – execute and read only (1 + 4)
6 – write and read only (2 + 4)
7 – execute, write and read (1 + 2 + 4)

For example:

sudo chmod 755 /opt/ 

Owner -> can execute, write and read
Current user -> can execute and read only
Anyone else -> can execute and read only

share|improve this answer
  1. Please open nautilus as root and access the files/folder.
  2. To change the ownership of the folder please see this thread: http://askubuntu.com/questions/6723/change-folder-permissions-and-ownership This will help you.
  3. Please don't use 777 - this would kill your cat.
share|improve this answer
6  
chmod 777 is never an option, use groups. – Shadok Nov 14 '12 at 17:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.