2

I want to give access to some folders in my home directory to another user on the same computer and vice versa. how do i do this? right now the other user is able to see the contents but is not able to open, copy, move etc the files from my home directory.

I do this easily while sharing with another computer using sshfs method i found else where. But am stuck doing this locally as i am relative rookie still in linux.

I am using lubuntu 14.04. Thanks.

note: this is a public family computer and this query is to simplify and ease local sharing of files and folders between each other.

2 Answers 2

3

To make folders in your home directory available for other users on the same computer (read/write), basically you need to do three things. The procedure for Lubuntu is quite the same as for Ubuntu, apart from the difference in the file browser.

1. Make other users member of the group: "yourusername"

  • The GUI way is to install gnome-system-tools (NB: In Lubuntu, it already is installed) and use the users and groups -section. Manage groups > choose yourusername > properties > add the other users by checking their checkboxes.

enter image description here

  • The command line way (if you don't want to use / install gnome-system-tools) to add an existing user to group <yourname>, is:

     usermod -a -G <yourname> <user_to_add>
    

2. Change the permissions of the folder you want to share:

On Ubuntu: right-click on the folder in nautilus and choose properties. In the permissions tab, change the group permissions for group yourusername to read & write.

Change the permissions for the files in the folder similarly (the button down in the nautilus properties window).

enter image description here

On Lubuntu: Change the permissions for the folder you'd like to share to at least read & write permissions for owner & group:

enter image description here

3.Set permissions for newly created files

Now you can access the shared folder from the other user's account(s) with full privileges to create and edit files and directories. However, if other users create new files, those files will be owned by the user who created them.

To give read, write and execute permissions (if the file is executable) on newly created files to all members of the group, there is still one thing left to do: run in a terminal (from the folder's owner account):

chmod g+s <shared folder>
5
  • This method works for the folders and all the sub folders. But individual files inside the folders still have execute permission as nobody. so i am able to open folders but i am not able to execute files. why is this? Can you tell me a solution to overcome this? Thanks. May 27, 2014 at 11:47
  • @newforubuntulinux I edited my answer. does this solve your issue? (at least for new executable files). Do you mean you had (existing) executable files that do not run any more? May 27, 2014 at 15:16
  • sorry for late reply. yes i had executables already. even if i create a new executable i see that in the properties execute option is set default to nobody. May 31, 2014 at 6:04
  • although the newly created files permission for execution is set as nobody i am able to execute and modify them with the other user. Jun 1, 2014 at 4:43
  • @newforubuntulinux When I do the setup like above, new files created from my account have permissions as follows: -rw-rw-r-- 1 jacob jacob, meaning I am owner, both I and the group with my name have r/w permissions. Files made by the other user(s) from their account (should) have: -rw-rw-r-- 1 testpersoon jacob, meaning the other user is owner, group has r/w permissions. similarly with executables. An executable made by other user: -rwxrwxr-x 1 testpersoon jacob, meaning the file is executable and both the group and owner have r/w/x permissions. Did you try ls -l? Jun 1, 2014 at 8:40
3

You could try

chmod 777 -R /home/youruser

But this is dangerous (it's not your / directory, but still). If it's for local sharing, etc. You could try setting up a samba share instead.

1
  • 2
    Thanks for your reply. can you tell my what this commad does and why it is dangerous so i can take a educated decision whether to try this or not? May 31, 2014 at 6:06

You must log in to answer this question.

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