Sharing files from a "Mounted" HDD

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
mattrixx
Level 3
Level 3
Posts: 130
Joined: Sat Apr 07, 2007 6:42 pm

Sharing files from a "Mounted" HDD

Post by mattrixx »

I have installed Mint15 Cinnamon and now would like to learn how to share files/Folders to my Networked computers from a second *DATA* (only) Hard Drive also installed on this same "MINT" (only) computer

I am able and do share files/Folders from the *Mint 15 O.S.* Hard Drive to my other Networked computers with NO problem. I can also "mount" the second Hard Drive while in the Mint O.S. drive, then access, copy, cut, paste files/Folders from each of the two HDDs back and forth with NO problem!

My question is: How can I share files/Folders from my second (non Mint O.S.) Hard Drive to my Networked computers?
I can "SHARE" a Folder like "VIDEOS" from the mounted second HDD, but can`t (apparently) set the PERMISSIONS correctly to actually allow access to the Networked computers.
Is there a reason I am not allowed to share files from a "mounted" hard drive in MINT15 to Networked computers? Am I missing an essential understanding?

I hope I have accurately explained what I`m trying to accomplish here? Any help or guidance would be appreciated
stratus_ss

Re: Sharing files from a "Mounted" HDD

Post by stratus_ss »

Part of this is related to how the system mounts the drives. When you are in Nemo/Files/Nautilus and you click on a drive to mount it will mount /media/... (usually). Since /media is a dynamic area (its used to mount devices that are external) it makes it more difficult for a beginner to share it out. I would recommend permanently mounting the drive somewhere and then sharing that out. That should always work

For example you could create a directory

Code: Select all

sudo mkdir /DATA
sudo chown $USER /DATA
sudo chmod 775 /DATA
And then share this out the way you have shared out other folders. Then editing /etc/fstab and adding the drive in there so that it mounts at boot (if you need help with this just ask!)

Hope this helps
altair4
Level 20
Level 20
Posts: 11458
Joined: Tue Feb 03, 2009 10:27 am

Re: Sharing files from a "Mounted" HDD

Post by altair4 »

You referenced 2 different situations so if you would post the output of the following commands it would be helpful:

Code: Select all

testparm -s

Code: Select all

net usershare info --long
This may be a very easy fix.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
mattrixx
Level 3
Level 3
Posts: 130
Joined: Sat Apr 07, 2007 6:42 pm

Re: Sharing files from a "Mounted" HDD

Post by mattrixx »

Hi stratus. Thanks for your kind reply to my forum question(s)

Yes, I would like some guidance on *permanently* mounting my second (non O.S.) Hard Drive I have previously named *939 DATA*.
Editing /etc/fstab is something I have never tried before, so any instruction would be welcomed and appreciated.

Some clarifications if you please:
Is the making a new Directory (you call DATA) *FIRST*, what you mean by: "mounting the drive somewhere and then sharing that out"? "Somewhere" in this case being this newly created Directory called DATA?
Also, is this what you mean by Editing /etc/fstab: "and adding the drive in there"? "In there" being this same newly created Directory called DATA?
Sorry if I sound confused, but I really do want to get this understanding clear!

Thanks again for your help
stratus_ss

Re: Sharing files from a "Mounted" HDD

Post by stratus_ss »

mattrixx wrote:Hi stratus. Thanks for your kind reply to my forum question(s)

Yes, I would like some guidance on *permanently* mounting my second (non O.S.) Hard Drive I have previously named *939 DATA*.
Editing /etc/fstab is something I have never tried before, so any instruction would be welcomed and appreciated.

Some clarifications if you please:
Is the making a new Directory (you call DATA) *FIRST*, what you mean by: "mounting the drive somewhere and then sharing that out"? "Somewhere" in this case being this newly created Directory called DATA?
Also, is this what you mean by Editing /etc/fstab: "and adding the drive in there"? "In there" being this same newly created Directory called DATA?
Sorry if I sound confused, but I really do want to get this understanding clear!

Thanks again for your help
No problem we all have to learn some time. the file /etc/fstab is a record of every device that should be automatically mounted. Take this for example

Code: Select all

# <file system>	<dir>	<type>	<options>	<dump>	<pass>
# DEVICE DETAILS: /dev/sda5 UUID=49320281-0c45-46cf-9594-c2001f9d9916 LABEL=SWAP
# DEVICE DETAILS: /dev/sda6 UUID=e13340f4-2281-492d-9783-1ec2eed2bf51 LABEL=
# DEVICE DETAILS: /dev/sda7 UUID=e71eb77e-0fa2-401d-aecb-490f103aa464 LABEL=archRoot
UUID=49320281-0c45-46cf-9594-c2001f9d9916             swap         swap defaults 0 0
UUID=e13340f4-2281-492d-9783-1ec2eed2bf51             /home        ext4 defaults 0 1
UUID=e71eb77e-0fa2-401d-aecb-490f103aa464             /                 ext4 defaults 0 1

//someserver/some_remote_folder /mnt/datafeed cifs auto,uid=devdata,gid=devdata,credentials=/etc/sophosshare,domain=mydomain.local,rw 0 0
In this case you can see several things, first, I have 3 local partitions, swap, home and the root or system drive. In this case I am using the unique identity of the hard drive (without getting into why, which is more advanced), but in the comments you can see the actual parition numbers.

Below that I am mounting a samba share from the domain, to my local folder. (This is in there just for education, you can ignore it). Lets pretend that I have a second disk. I can find what my disks are called with the following command:

Code: Select all

sudo fdisk -l |grep sd
This will tell you if they are sda, sdb, sdc or so on. In this case lets *assume* that my big non-linux mint disk is /dev/sdb1. To find the uuid you can do this:

Code: Select all

[root@someserver tmp]# ls -l /dev/disk/by-uuid/
total 0
lrwxrwxrwx 1 root root 10 Oct 18 16:32 1667aed5-7185-49ff-8084-13fcc50cb193 -> ../../sda2
lrwxrwxrwx 1 root root 10 Oct 18 16:32 2d838da3-f4c3-4113-8126-92293da47fd6 -> ../../sdb1
You can see that the UUID in question is 2d838da3-f4c3-4113-8126-92293da47fd6. Next I decide where I want to mount this folder, somewhere that it is always active. I am going to choose /DATA. I now create this folder since it doesnt exist yet. After its created, I want to make sure my user owns the directory and that it is at least world readable (this is my preference and not required)

Code: Select all

sudo mkdir /DATA
sudo chown $USER /DATA
sudo chmod 775 /DATA
After this, I need to tell the computer to put it there every time the computer turns on by editing the /etc/fstab file. You can do this from the terminal like I do, or from something like gedit or other editor. I use terminal commands because I find them faster

Code: Select all

#This gives me a root shell to do the edit
sudo -s
echo "#This is my /dev/sdb1 drive" >> /etc/fstab
echo "UUID=2d838da3-f4c3-4113-8126-92293da47fd6             /DATA                 ext4 defaults 0 1" >> /etc/fstab
The last thing you have to do is make sure the hard drive mounts.

Code: Select all

sudo mount -a
The mount -a command re-reads the fstab and ensures that everything is mounted from that file. At this point you should be able to share out /DATA as you have done for all the other folders

NOTE: I am assuming the disk is formatted EXT4, if not, change the echo command as appropriate

Is this more clear now?
mattrixx
Level 3
Level 3
Posts: 130
Joined: Sat Apr 07, 2007 6:42 pm

Re: Sharing files from a "Mounted" HDD

Post by mattrixx »

Thanks again stratus_ss

Your new reply to me will take me some time to digest! I will print it out and refer to this, but I think I understand the process?

Question:
You replied: "NOTE: I am assuming the disk is formatted EXT4, if not, change the echo command as appropriate."
If in your "NOTE", the disk you are referring to is my Linux drive then YES, the Linux HDD is formatted EXT4. The 2nd. hard drive labeled "939 DATA" by me, is formatted NTFS... if that matters?
mattrixx
Level 3
Level 3
Posts: 130
Joined: Sat Apr 07, 2007 6:42 pm

Re: Sharing files from a "Mounted" HDD

Post by mattrixx »

altair4 wrote:You referenced 2 different situations so if you would post the output of the following commands it would be helpful:
CODE: SELECT ALL
testparm -s

CODE: SELECT ALL
net usershare info --long
Hi altair4 and thanks for your reply to my post.

I`m going to try and paste these outputs you requested to this post. NOTE: This "output" is without any sharing attempt by me of my second hard drive. This output indicates my successful sharing of LINUX HDD "VIDEO" Folder to my Networked computers

mistereee@MINT-A8V:~$ testparm -s
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[printers]"
Processing section "[print$]"
Loaded services file OK.
Server role: ROLE_STANDALONE
[global]
server string = %h server (Samba, Ubuntu)
map to guest = Bad User
obey pam restrictions = Yes
pam password change = Yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
unix password sync = Yes
syslog = 0
log file = /var/log/samba/log.%m
max log size = 1000
dns proxy = No
usershare allow guests = Yes
panic action = /usr/share/samba/panic-action %d
idmap config * : backend = tdb

[printers]
comment = All Printers
path = /var/spool/samba
create mask = 0700
printable = Yes
print ok = Yes
browseable = No

ALSO:

mistereee@MINT-A8V:~$ net usershare info --long
[Videos]
path=/home/mistereee/Videos
comment=
usershare_acl=Everyone:F,
guest_ok=y

mistereee@MINT-A8V:~$
stratus_ss

Re: Sharing files from a "Mounted" HDD

Post by stratus_ss »

please use

Code: Select all

 tags for posting output. There is a little code button at the top of the reply window.

As for NTFS for your 939 DATA drive, yes that makes a difference as you will have to change the fstab section "ext4" to "ntfs"

For reference I dont believe testparm will do any good as I believe OP is using nautilus-share (i.e. right clicking and sharing folders this way). That being the case the smb.conf file will not change and therefore testparm is not useful

To the OP, all that jibberish is explained like this. In the old way of sharing out folders you manually edited /etc/samba/smb.conf and then restarted samba. "testparm" is a program which checks smb.conf for errors and then reports back. Since I doubt you are using the old style of sharing, using testparm will not produce anything. The second option mentioned is what provides information on your current shares. 

altair4 was most likely just covering all the bases at once
altair4
Level 20
Level 20
Posts: 11458
Joined: Tue Feb 03, 2009 10:27 am

Re: Sharing files from a "Mounted" HDD

Post by altair4 »

Remember to share and access a partition either locally or as a samba client the partition must be mounted. When you open up Nemo and access the NTFS partition you mount it. At that point you can share it through Nemo but there is a problem with this mechanism. It mounts to:
/media/mistereee/something.

The permissions on /media/mistereee are set by the system using an Access Control List that prevents anyone from accessing "something" who isn't mistereee.

So my recommendation if you want to have this work as is:

[1] Edit /etc/samba/smb.conf
gksu gedit /etc/samba/smb.conf
[2] Add a line under the workgroup line towards the top of the file:

Code: Select all

force user = mistereee
[3] Then restart samba:

Code: Select all

sudo service smbd restart
[4] Now go into Nemo and access the ntfs partition so that it is mounted and share the partition or folder you want shared.

The remote guest user should now have access to the folder.

You can skip the step of mounting the partition if you follow stratus_ss's recommendation to have it automount but to have it comply with a dual boot situation and still accommodate the nemo-share process of samba share creation I would recommend adding "uid=1000" and "windows_names" to the list of options in the fstab line.

Side note: It really doesn't matter since it will correct itself anyway but setting permissions on a mount point before the partition is mounted will do nothing since it will be overridden by the permissions of the mount itself.
Last edited by altair4 on Tue Nov 26, 2013 4:07 pm, edited 1 time in total.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
altair4
Level 20
Level 20
Posts: 11458
Joined: Tue Feb 03, 2009 10:27 am

Re: Sharing files from a "Mounted" HDD

Post by altair4 »

Your assessment of testparm is partially correct but keep in mind that smb.conf still has control of usershares - but at a global level not at a share level.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
altair4
Level 20
Level 20
Posts: 11458
Joined: Tue Feb 03, 2009 10:27 am

Re: Sharing files from a "Mounted" HDD

Post by altair4 »

So to automount the ntfs partition the line in fstab would look something like this:

Code: Select all

UUID=DA9056C19056A3B3 /DATA ntfs defaults,nls=utf8,umask=000,uid=1000,windows_names 0 0
*** To find the correct UUID number run this command:

Code: Select all

sudo blkid -c /dev/null
*** Create the mount point:

Code: Select all

sudo mkdir /DATA
Don't bother chmod'ong or chown'ing it it won't matter after the mount.

Then run:

Code: Select all

sudo mount -a
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
Locked

Return to “Beginner Questions”