2

I am trying to set file permissions for a folder named Sales. I am doing a school project and I want to give a tutorial regarding file permissions.

I am using vmware workstation and when I go on Sales permissions and try to set a file permission, it will return to -.

Also, I cannot tick to execute the file as a program :S...

When I try to do so the tick will also automatically vanish.

This is rather strange but don't know what is going on.

1
  • Please provide the following information in your post: ls -lah Sales and whoami Oct 24, 2011 at 19:22

3 Answers 3

5

Open a terminal, and to give the executive flag, do this :

chmod +x a.sh

where a.sh is the file that you want to be executable.

To change read, or write permission, do this:

chmod -r a.sh # make it non-readable
chmod +r a.sh # make it readable
chmod -w a.sh # make it non-writeable
chmod +w a.sh # make it writeable

As every file belongs to a user and belongs to a group, you can be specific to user, group or everybody prefixing the permission option with the letters u, g and o respectively. So you could:

chmod g+w a.sh # make it writeable by the group a.sh belongs
chmod o-w a.sh # make it non-writeable by others than the user and the group a.sh belongs
chmod g+w,o-w a.sh # The same as the two lines before, but in one line

For more options, check man chmod

0
2

to remove read write and execute permissions

% chmod go-rwx (file name)

To give read and write permissions (all file)

% chmod a+rw ur filename


   
    Symbol
    Meaning
  
   
    u
    user
  
   
    g
    group
  
   
    o
    other
  
   
    a
    all
  
   
    r
    read
  
   
    w
    write (and delete)
  
   
    x
    execute (and access directory) 
  
   
    +
    add permission
  
   
    -
    take away permission
  


0

Please clarify. Which version of Ubuntu are you using? Are you using the GUI to edit these permissions? (You mentioned a 'tick'.)
You said you are using VMWare. Is this folder on the same Virtual Machine? Or on the Host/Network, etc.?
Last but not least, Do you own the folder? Only the owner (or root) can change the permissions on a file or folder.

Also to expand on Vjo's answer. The instructions he gave you will apply the permissions 'across the board' to the user, group and all others. If you want to be more specific as to who you are applying the permissions to you can also use u, g + o to assign those rights to the user(u), the group(g), or others(o)

For example:

chmod u+x filename

Would add execute permissions to the 'filename' file for the user only. If you wanted to add write(w) permissions to the user(u) and group(g), then you could use:

chmod ug+w filename

Plus(+) adds the permission, Minus(-) removes the permissions, and Equal (=) sets the permission.

4
  • Hi, yes I am using Ubuntu 11.10 GUI version and I would prefer to do everything based on GUI rather commands.The folder is also on the same Virtual Machine and I also own the folder. In fact I only have 1 user and I was testing such permissions. It is important to note that I was able to do such permissions but all of a sudden I cannot....Ubuntu just crashed! And since I am using VMWARE I installed the image again from the beginning, but still everything remained the same
    – Matthew
    Oct 25, 2011 at 10:15
  • You might try opening the file browser as root. Using gksudo nautilus from the terminal. Please be careful though since you'll be operating as root. It's still possible for the folder to belong to someone else. Root would be an example. You should be able to see the owner in properties window. Oct 25, 2011 at 19:37
  • Hi, I appreciate your help but still nothing works.....I am the owner of the folder and still I cannot do anything. I think there is a bug between Ubuntu and using a virtual machine. The reason is that yesterday I was able to give file permissions to the same folder and today I cannot change them.....they return back to - and also I cannot tick a box...it does not work.
    – Matthew
    Oct 26, 2011 at 12:24
  • Hmm.. I suppose it could be a VMWare compatibility issue, but I've never experienced one like this so I couldn't be certain. I've been a VMWare user for about three years, but for limited applications. Teaching classes actually. Oct 26, 2011 at 14:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .