0

I am typing this:

chmod 777 /home/to the destination ...

image

But all locked and what I want to do is to make all files and folders to have read and write permission without doing each file/folder separately.

5

Giving files a 777 permission is absolute overkill, mind that you give with this your user full access, the user group full access and all others. So from a security standpoint this is a horrible solution.

Permissions are octal and each number represents what you can do with the file:

Number  Permission Type       Symbol
------------------------------------
0       No Permission         ---
1       Execute               --x
2       Write                 -w-
3       Execute + Write       -wx
4       Read                  r--
5       Read + Execute        r-x
6       Read +Write           rw-
7       Read + Write +Execute rwx

So it is definitively enough to give your user full and the group and others limited access (i.e. 755).

To do this recursively you can use the -R flag and the -v flag to get a verbose output of the action. So the line you search for is:

sudo chmod - Rv 755 /path/destination

See here and here for further reading into.

2

It should be noted that this is a dangerous thing to do as it effectively removes all permission-based security of all files and subdirectories and will break e.g. ssh!

If you insist on doing something dangerous, can recursively make a home directory and all files/subdirectories read/write by all users on the system with:

sudo chmod -R 777 /home/username
  • 1
    @Videonauth Does my edit address your concern? – blihp Oct 5 '18 at 7:03
  • It does, thus reversed my downvote. – Videonauth Oct 5 '18 at 7:08
  • 1
    Note that ssh will cease to work after that command because it requires more restrictive permissions for the .ssh folder and the files therein. – PerlDuck Oct 5 '18 at 8:05
  • @PerlDuck you are correct and there are potentially more things that could be problems as well. I was only addressing the original question that was asked. (i.e. how to do it, not if it was a good idea) – blihp Oct 5 '18 at 8:12
  • 1
    blihp Warn people first if they're about to do something dangerous instead of telling them how to do it. And sometimes it's better to plainly tell people not do do something! (edited but not upvoted nor downvoted though I disagree with you) – Fabby Oct 5 '18 at 8:45

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.