Trying to share a folder between two users on the same machine, and encountering some issues
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
The /home/ is sometimes restricted depending on distro (access control lists?). You might need to link it / mount -o bind it to a more "common" location.
Using chown changes the owner and the group. Don't forget the permissions 660? If it's another storage device, it could need special treatment too. It could also be a network share that each user mounts, even if the network is lo / 127.0.0.1. Which might be the simpler option (better documentation / more common).
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150
Rep:
the link will have no real perms of its own it will have the perms of the linked file, sort of.
you will also need the correct accese perms for all the intermediate folders not just the target.
I created a link and moved the link to user-B's desktop, but it says the link is broken there.
You might use a bind mount instead of a symbolic link.
Code:
sudo mount --bind /path/to/sourcedir/ /path/to/copy/
Then if that works for you, it can be added to /etc/fstab to be made persistent across reboots.
But that said, you will eventually run into problems with group ownership of files within a shared directory. There are two ways to address that. It's not as easy as Netware was but once you've set things in place they stay set.
touch /media/data/share/dummyDidThis
ls /media/data/share
dummyDidThis
done
as stated before, I'd create a common area for the share folder/directory then attach the a chown's group and give each person that you want to use that share the group in there groups listings. permissions 775 for the share directory.
read write execute for both owner and group. bind mount or reg mount in fstab to the common area if it is on a separate partition that both can access at the same time.
( the common straight forward mount in fstab off a partition for more than one system I am not sure about, it sounds logical, but I only have one laptop to experiment with)
660 being read write for both owner and group, which ever you need. that would eliminate putting (usable) executables into that dir.
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150
Rep:
Another alternative is to use a local samba share, like so:
Code:
keithhedger@LFSBomb20:~-> cat /etc/samba/smb.conf
[global]
workgroup = WORKGROUP
server string = %h
wins support = no
dns proxy = no
security = user
encrypt passwords = true
panic action = /usr/share/samba/panic-action %d
[public]
path = /home/keithhedger/Public
writeable = yes
browseable = yes
read only = no
guest ok = no
That way at some future time if you need more users to have acces to the folder you don't need to muck about with permissions, groups etc.
I have a work account and a play account on the same machine.
I want one directory to be (recursively) available to both.
I created a group, added both users to it, and made the group the owner of the directory (using chgrp).
The directory is on user-A's Desktop.
I created a link and moved the link to user-B's desktop, but it says the link is broken there.
Any ideas on how to proceed?
Thanks
If the directory is on user-A's Desktop that means it is user-A's home, so the common group must have at least execute rights on user-A's home and the ~/Desktop directory.
What exactly do you mean by "creating a link"? If you did it through the GUI you might be talking about a .desktop file or so? Which might have a relative path in it so moving it would break it?
As others have stated: Don't put the directory in one user's home but use a separate location.
There is also one other caveat: When you create new files in the directory, they might not be given the common group and might not be given the right permissions.
The first can be adressed by making the common group the default group of both users, the other one is controlled by the umask.
Type umask in the terminal. If it says something like 002 you are fine. But if it says e.g. 022 one user won't be able to write to files created by the other.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.