Sharing a folder thats not in the home dir [SOLVED]

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
hoboagogo

Sharing a folder thats not in the home dir [SOLVED]

Post by hoboagogo »

Hello,

I am trying to share a folder that is on a separate mounted hdd (separate to where Linux Mint is installed) so a windows 7 machine can view it.

I have searched google and also read this very useful how to share a folder guide:

http://forums.linuxmint.com/viewtopic.php?f=42&t=23169

The guide mentions:

"Please note that you can only share folders that you own ( i.e., folders in your own home directory ). "

Does this mean I will never be able to share the folder on my secondary HDD?

Should I reinstall Linux Mint on the HDD where I want to share a folder. I'm sure this isn't the case and I must be able to share the folder another way, perhaps more complicated than the right click share (which I tested on a folder in my home directory and works fine, the windows 7 machine can view it.)

Let me know if you need any more info about my setup. Thanks for your time.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
richyrich

Re: Sharing a folder thats not in the home dir

Post by richyrich »

Something to try ?
In the file manager, right-click the ext hd folder, choose Open as Root. Login, then right-click inside the folder window, choose Properties -> Permissions tab. Then add your username with read/write privileges, and set the same for Others if you want. Then close. You should now be able to share that folder normally.

Let us know if this helps . . . richy :)
hoboagogo

Re: Sharing a folder thats not in the home dir

Post by hoboagogo »

Hi Richy,

Thanks for the quick response.

I have followed your instructions, and when I open as root and login the folder changes to red which I presume indicates I have root access to that folder.

However when I right click and attempt to change file access properties for the owner, a specific user-name or 'others' - any alterations I make (I try and add read/write privileges) do not stick, i click close and when looking at them again they appear to be still not set to read/write.

Odd, am I missing a step?
StanTheMan

Re: Sharing a folder thats not in the home dir

Post by StanTheMan »

When you are installing Linux-Mint , at the partitioning table select the partition that you want to share ( e.g. /dev/sdb1 ) to mount NTFS on /windows . The installer will make that directory (/windows) read and write for the group ' plugdev ' and the installer will make your sudo UserName a member of the 'plugdev' group. This allows the sudo User to read and write to the NTFS partition sharing it with Windows.

We used to format shared partitions as FAT32 , then both system could read and write to it .
Lantesh

Re: Sharing a folder thats not in the home dir

Post by Lantesh »

You can make a symbolic link in your home directory that points to the folder on the other hard drive. Then simply share the link.
altair4
Level 20
Level 20
Posts: 11461
Joined: Tue Feb 03, 2009 10:27 am

Re: Sharing a folder thats not in the home dir

Post by altair4 »

Along with the suggestions offered above, there are two basic ways I deal with this issue:

(1) Take ownership of the other partition.

If you tell us where the partition is, how it's formatted, and how you are mounting it, we can help you change ownership.
It could be a change to the fstab entry for that partition is it's an fat32 or NTFS partition or a simple chown if it's an ext3/4 partition.

(2) Add an entry into smb.conf that allows a user to share directories he doesn't own.

Although Nautilus-share allows you to do this I really don't like to use it but that decision is up to you.

Open Terminal
Type gksu gedit /etc/samba/smb.conf

Add the following line in the [global] section of smb.conf:

Code: Select all

usershare owner only = false
Save the file, exit gedit, and back in the Terminal type:
sudo service samba restart

One of the problems with this method is that if you have multiple users on your system all of them will now be able to share anything they want to share. The other problem is you may share a directory that you yourself as a local login user don't have access to. I personally prefer method (1) but that's up to you.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
hoboagogo

Re: Sharing a folder thats not in the home dir

Post by hoboagogo »

Ok, I will go through my attempts so far.
When you are installing Linux-Mint , at the partitioning table select the partition that you want to share ( e.g. /dev/sdb1 ) to mount NTFS on /windows . The installer will make that directory (/windows) read and write for the group ' plugdev ' and the installer will make your sudo UserName a member of the 'plugdev' group. This allows the sudo User to read and write to the NTFS partition sharing it with Windows.
Thanks, I will definitely try this as a last resort, but I would prefer not to have to reinstall (but will if nothing else helps).
You can make a symbolic link in your home directory that points to the folder on the other hard drive. Then simply share the link.
Ok, I tried this, had a look at what a symbolic link is and entered the command console to try and create a link to the share, this is the command I used after a few attempts:

Code: Select all

tclinux@tclinux-desktop ~/Music $ sudo ln -s /home/tclinux/Music /media/Music
A link appeared in the directory, and I can see it when I am on the windows7 machine, however when I click it I presume it is just a link to the base directory, all the music I am trying to share is in subdirectories. Do I need to create symbolic links for each sub-directory or am I missing a command when using the console?
(2) Add an entry into smb.conf that allows a user to share directories he doesn't own.
Thanks, I tried this one, entered the line as mentioned and restarted samba, this didnt appear to fix the problem, after sharing a directory again I could see it on the windows7 machine but not enter the directory.
(1) Take ownership of the other partition.

If you tell us where the partition is, how it's formatted, and how you are mounting it, we can help you change ownership.
It could be a change to the fstab entry for that partition is it's an fat32 or NTFS partition or a simple chown if it's an ext3/4 partition.

Ok, I would like to try changing ownership, will try to answer your questions with some info from Palimpsest disk utility:

1000GB
NTFS File System
Partition 1 (HPFS/NTFS (0x07))
/dev/sdb1 mounted at /media/newvolume

Thanks for all the help so far.
altair4
Level 20
Level 20
Posts: 11461
Joined: Tue Feb 03, 2009 10:27 am

Re: Sharing a folder thats not in the home dir

Post by altair4 »

I'm getting confused.

Are you mounting this partition is fstab?
Or are you mounting it through Nautilus?

It it's the latter then you probably are the owner of the mount point and you can use simple sharing to share it.

Open Nautilus, right click on /media/newvolume, select "Sharing Options", click on all three boxes, and select "Create Share".

You'll immediately get an error if you are not the owner.

*****************************************************************************

Scrap all that I think I figured it out. The partition is being mounted with permissions of 0700. Only you, locally, can read and write to it. Did you add

Code: Select all

force user = your_user_name
to smb.conf as the HowTo suggested?
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
hoboagogo

Re: Sharing a folder thats not in the home dir

Post by hoboagogo »

Scrap all that I think I figured it out. The partition is being mounted with permissions of 0700. Only you, locally, can read and write to it. Did you add

Code: Select all
force user = your_user_name

to smb.conf as the HowTo suggested?

Solved!

Worked a treat, thanks a lot altair4, appreciate you helping this noob.
Locked

Return to “Beginner Questions”