I am working with Ubuntu and I have a jar file in this folder /export/home/david

And I am logged in machineB as david user.

Some other user is also logged in that same machine. And I want other user to copy the above jar file from my location.

But somehow they are not able to do that as they are getting permission denied. Is there any way I can add some permission on that jar file or on my folder so that anybody can copy the files from that folder?


Below is the result I got -

david@machineB:~$ groups david
david : uucp

otheruser@machineB:~$ groups otheruser
otheruser : app

david@machineB:~$ ls -l foo.jar
-rw-r--r-- 1 david uucp 6543346 2014-03-07 18:27 foo.jar

david@machineB:~$ ls -ld $(echo "/home/david/foo.jar" | sed -r ':a; s#(.*)/[^/]*$#\1#;p;ta')
drwxr-xr-x 22 root   root 4096 2014-05-04 08:04 /home
drwx------  4 david uucp 4096 2014-03-07 18:36 /home/david
  • That should actually be possible out of the box. Please edit your question and post the output of these commands: groups david, groups otheruser and the permissions for the file (ls -l foo.jar) and its parent directories. If your file is at /home/david/foo/bar.jar, you can get them easily with: ls -ld $(echo "/home/david/foo/bar.js" | sed -r ':a; s#(.*)/[^/]*$#\1#;p;ta').
    – terdon
    May 13, 2014 at 23:23
  • @terdon: I have updated the question with all the details you needed. Let me know if there is anything else you want me to post.
    – arsenal
    May 14, 2014 at 0:07

3 Answers 3


Well, for some strange reason, your $HOME directory is only accessible to you. This is not the default on any system I am familiar with, you or your sysadmin have probably set it up this way.

Anyway, all you need to do is give everyone read/execute access to your $HOME. This is the norm on most multi-user systems to allow people to share their work. Just run this command:

chmod a+rx ~/

This will set the permissions of your home to rwxr-xr-x and allow anyone to copy files from your $HOME.

  • 1
    Not only did your answer solve a problem, I learned a bit more about Linux from its use. Dec 3, 2017 at 2:11

In order to give someone read access to a file of yours, they need to have read permission on the file and execute permission on all the directories leading to the file. For example, to allow Alice to read /home/david/for_alice/foo.jar, you need to ensure that Alice has the read permission to foo.jar and execute permission on /home/david and /home/david/for_alice. The execute permission on a directory is needed to access files inside that directory by their name; the read permission on a directory is needed to list the names of the files in the directory. Read permission on the directories is not strictly needed, but it more convenient, especially if Alice is going to use a GUI to browse the files.

At the moment, your home directory has the permissions rwx------, i.e. only you can access files in it.

If the files are local and ACL tools are available, you can grant access to Alice. The following commands give Alice read access to for_alice and all files underneath, but does not allow her to list the files in your home directory (she can still access files in your home directory if she guesses their name):

setfacl -m user:alice:x ~
setfacl -Rd -m user:alice:rX ~/for_alice
setfacl -R -m user:alice:rX ~/for_alice

If ACLs aren't possible, you'll have to allow group-wide or system-wide access.

chmod +x ~
chmod -R a+rX ~/public

chmod o+r /path/to/file will allow world read permissions on the file you want your friends to be able to copy.

chmod -R o+r /path/to/directory; find /path/to/directory -type d -exec chmod o+x {} \+ to allow other users to read all files in /path/to/directory. As Patrick pointed out, you will need to add world read and execute (chmod o+rx) on all parent directories as well. I don't know off the top of my head the easiest way to script this, but I'm sure it's possible.

  • 3
    Don't forget, the parent directories need to be accessible as well.
    – phemmer
    May 13, 2014 at 22:46
  • 1
    Make that chmod -R o+rX (capital X), you don't need the find command. May 14, 2014 at 0:43

You must log in to answer this question.

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