LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 08-18-2018, 03:40 PM   #1
yhtgr
LQ Newbie
 
Registered: Aug 2018
Posts: 1

Rep: Reputation: Disabled
Trying to share a folder between two users on the same machine, and encountering some issues


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
 
Old 08-18-2018, 04:07 PM   #2
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 3,928
Blog Entries: 1

Rep: Reputation: 832Reputation: 832Reputation: 832Reputation: 832Reputation: 832Reputation: 832Reputation: 832
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.

$ sudo mount -o bind /home/user/Desktop/shared /mnt/SHARED
$ sudo chown -R group:group /mnt/SHARED*

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).
 
Old 08-18-2018, 04:17 PM   #3
scasey
Senior Member
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.6
Posts: 3,778

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
What are the permissions of the link?

Maybe UserB needs to create the link?

What distro and desktop environment are you using?
 
Old 08-18-2018, 06:42 PM   #4
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Linux From Scratch, Slackware64, Partedmagic
Posts: 2,715

Rep: Reputation: 680Reputation: 680Reputation: 680Reputation: 680Reputation: 680Reputation: 680
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.
 
Old 08-19-2018, 03:53 AM   #5
fatmac
Senior Member
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Posts: 3,119

Rep: Reputation: Disabled
If you are both in the group that owns it, why are you making links(?), just open it.

If you must have links to it, create them in each users home directory, (don't copy).

Last edited by fatmac; 08-19-2018 at 03:56 AM.
 
Old 08-19-2018, 04:02 AM   #6
Turbocapitalist
Senior Member
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 4,160
Blog Entries: 3

Rep: Reputation: 2061Reputation: 2061Reputation: 2061Reputation: 2061Reputation: 2061Reputation: 2061Reputation: 2061Reputation: 2061Reputation: 2061Reputation: 2061Reputation: 2061
Quote:
Originally Posted by yhtgr View Post
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.
 
Old 08-19-2018, 03:02 PM   #7
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: FreeBSD/Slackware-14.2+/ArcoLinux
Posts: 9,133

Rep: Reputation: 1925Reputation: 1925Reputation: 1925Reputation: 1925Reputation: 1925Reputation: 1925Reputation: 1925Reputation: 1925Reputation: 1925Reputation: 1925Reputation: 1925
this is what i did I have a hdd mounted on /media/data
Code:
mkdir /media/data/share
chown userx:users /media/data/share
useradd -m dummy
passwd dummy
moduser -aG users dummy
chmod 775 /media/data/share
changed ttys logged in dummy and
Code:
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.

Last edited by BW-userx; 08-19-2018 at 03:19 PM.
 
Old 08-20-2018, 05:53 AM   #8
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Linux From Scratch, Slackware64, Partedmagic
Posts: 2,715

Rep: Reputation: 680Reputation: 680Reputation: 680Reputation: 680Reputation: 680Reputation: 680
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.
 
Old 08-22-2018, 03:12 PM   #9
joe_2000
Senior Member
 
Registered: Jul 2012
Location: Aachen, Germany
Distribution: Void, Debian
Posts: 1,013

Rep: Reputation: 305Reputation: 305Reputation: 305Reputation: 305
Quote:
Originally Posted by yhtgr View Post
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Share folder on Virtual Machine iFunction Linux - Newbie 4 08-21-2016 09:15 AM
[SOLVED] Share folder to all users. brave heart Ubuntu 7 04-20-2011 08:21 AM
How to web share a folder on solaris machine kalpeshmahadik Solaris / OpenSolaris 3 04-27-2006 09:33 AM
how to share folder with users salahuddin_66 Linux - General 4 08-11-2004 10:43 AM
trying to share folder between 2 users aymbpc Linux - Newbie 6 09-22-2003 07:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration