Chmod's recursive is with a capital "R" and the option -R comes before the permissions, which themselves come before the directory. Thus:
sudo chmod -R 777 dir/name
should do what you want.
However, I always have trouble telling people to go chmodding 777 willy-nilly.
All directories outside of your home directory are read-only by default. There are three types of privileges: "read", "write", "execute" for three sets of users. If you run the command ls -l
on the directories in question, you should see something like this:
drwxr-xr-x 4 shannon admin 136 Oct 7 18:22 chunkers/
drwxr-xr-x 122 shannon admin 4148 Nov 1 08:22 corpora/
drwxr-xr-x 12 shannon admin 408 Nov 1 08:22 grammars/
The security of a Linux system is primarily based on the fact that only root can do anything. Everyone else, including your username, has to ask for permission. This may seem like a hassle, but we Linux users are happy that everyone has to ask permission.
So, what does this crap mean:
drwxr-xr-x 4 shannon admin some-numbers date-time dir/name
drwx
: This is a 'd' (directory) that user/owner (shannon) can do the following for rwx
.
r-x
: Group (in this case admin) can do the following: rx
(read and execute, not write).
r-x
: Others (anybody other users) can do the following: rx
.
et cetera.
To edit that file, you can permanently change owner of the directory in question to yourself:
sudo chown -R yourusername /usr/local/lib/python2.7/dist-packages/nltk/
Of course, there are many different ways you can give yourself permission to edit stuff (for instance, you can sudo chgrp -R g+w dir/name
and then make sure your username is part of the group that can now write to the directory). This is a nice way to make it so that others can do things to do this directory.
Probably the best solution is to edit the file using sudo and a command-line editor, because you probably won't be editing the file multiple times, will you?
sudo nano /usr/local/lib/python2.7/dist-packages/nltk/metrics/segmentation.py
Use CTRL+o to save and CTRL+x to exit.
Anyway, some answers are less secure than others, but I've always been hesitant to chmod 777 everything. Maybe I was taught to be too paranoid.