AutoMOUNT resources from your home SAMBA server on your PC.

Moderator: Forum moderators

Post Reply
Clarity
Posts: 4235
Joined: Fri Jul 24, 2020 10:59 pm
Has thanked: 1814 times
Been thanked: 571 times

AutoMOUNT resources from your home SAMBA server on your PC.

Post by Clarity »

Here are my instructions presenting this in some easy to understand write-up. This allows your PC or Laptop or Tablet to automatically access and mount your home server's resource, for you, each time you boot your system.

A single document with example commands <=== click

If you questions or comments to correct, change, or improve, please post them to this thread.

Clarity
Posts: 4235
Joined: Fri Jul 24, 2020 10:59 pm
Has thanked: 1814 times
Been thanked: 571 times

Re: AutoMOUNT resources from your home SAMBA server on your PC.

Post by Clarity »

Anyone making a video of the steps, PLEASE, post a link on this thread to help others.

User avatar
wizard
Posts: 2169
Joined: Sun Aug 09, 2020 7:50 pm
Location: Oklahoma, USA
Has thanked: 2980 times
Been thanked: 799 times

Re: AutoMOUNT resources from your home SAMBA server on your PC.

Post by wizard »

@Clarity

It would be better if you posted a copy of the document directly on the forum.

Thanks
wizard

Big pile of OLD computers

Clarity
Posts: 4235
Joined: Fri Jul 24, 2020 10:59 pm
Has thanked: 1814 times
Been thanked: 571 times

Re: AutoMOUNT resources from your home SAMBA server on your PC.

Post by Clarity »

Hello @wizard
If you know a way to create a Markup doc from a MS or Google Doc, I'm all ears. To have created it using the bulletin-board tools would have taken me a much longer time.

If you have a method that works for you and can share it, post it via PM.

BTW: Did you find anything glaring or missing to address its use? Your insight is valuable.

User avatar
wizard
Posts: 2169
Joined: Sun Aug 09, 2020 7:50 pm
Location: Oklahoma, USA
Has thanked: 2980 times
Been thanked: 799 times

Re: AutoMOUNT resources from your home SAMBA server on your PC.

Post by wizard »

@Clarity

BTW: Did you find anything glaring or missing to address its use? Your insight is valuable.

Don''t use Google Docs, so have not viewed it. Why not just put it in a simple .doc file and add as an attachment?

wizard

Big pile of OLD computers

Clarity
Posts: 4235
Joined: Fri Jul 24, 2020 10:59 pm
Has thanked: 1814 times
Been thanked: 571 times

Re: AutoMOUNT resources from your home SAMBA server on your PC.

Post by Clarity »

I sent it to you personally via PM, later.

User avatar
bigpup
Moderator
Posts: 7512
Joined: Tue Jul 14, 2020 11:19 pm
Location: Earth, South Eastern U.S.
Has thanked: 1021 times
Been thanked: 1682 times

Re: AutoMOUNT resources from your home SAMBA server on your PC.

Post by bigpup »

@Clarity

pdf document.

Auto Mount a SAMBA resource via fstab.pdf
(90.48 KiB) Downloaded 18 times

txt document

Auto Mount a SAMBA resource via fstab.txt
(4.24 KiB) Downloaded 8 times

I made these by going to the link location you have posted.
Select file ->Download
Used options this provides to produce them.

The things you do not tell us, are usually the clue to fixing the problem.
When I was a kid, I wanted to be older.
This is not what I expected :o

User avatar
bigpup
Moderator
Posts: 7512
Joined: Tue Jul 14, 2020 11:19 pm
Location: Earth, South Eastern U.S.
Has thanked: 1021 times
Been thanked: 1682 times

Re: AutoMOUNT resources from your home SAMBA server on your PC.

Post by bigpup »

Here it is as a post written out.

Auto Mount a SAMBA resource via fstab
Mounting a remote LAN Samba server’s resource(s) at PC boot-time via /etc/fstab in Linux allows you to automatically connect to your shared network folders upon system boot. Here's a breakdown of how to do it, along with important considerations:
1. Before beginning, you must gather the following important information
On the SAMBA/’smb’ server
The smb username-password pair for remote users to be recognized must be registered
The resources to share must be defined
The following terminal command MUST work to show SAMBA active and capable of sharing its resources
smbclient -U% -L localhost

2. On your LAN PC, create a Mount Point that will be used to show the SAMBA resource:
Decide where you want to mount the Samba resource on your local file system. This will be your filesystem’s mount-point for the resource. Create a directory for it:
Example: sudo mkdir /mnt/samba-share

3. Create a Credentials File (Recommended) with your Server’s username it allows:
For security, it's best to store your Samba username and password in a separate credentials file rather than directly in /etc/fstab.
Create a file: sudo geany /etc/samba/credentials
Add the following lines, replacing with your actual credentials:
username=that_samba_expects
password=for the user above

After saving the credentials file,
Set security permissions for the credentials file:
sudo chmod 400 /etc/samba/credentials
sudo chown root:root /etc/samba/credentials

4. Edit /etc/fstab:
Open /etc/fstab with root privileges: sudo geany /etc/fstab
Add a line with the following format:
//<ip_address or hostname>/<share_name> /mnt/<mount_point> cifs credentials=/etc/samba/credentials,iocharset=utf8,vers=3.0,uid=<your_local_user_id>,gid=<your_local_group_id>,_netdev 0 0
Explanation of options:
//<server_ip_or_hostname>/<share_name>: The network path to your Samba share. Replace with the server's IP address or hostname and the share name.1
1.Mounting and mapping shares between Windows and Linux with Samba - Red Hat (www.redhat.com)
/mnt/<mount_point>: The local directory where you want to mount the share.
cifs: Specifies the file system type.
credentials=/etc/samba/credentials: Points to your credentials file.
iocharset=utf8: Handles character encoding.
vers=3.0: specifies the samba version. Adjust if needed.
uid=<your_local_user_id>: Sets the owner of the mounted files to your local user. To get your user id, type id -u in the terminal.
gid=<your_local_group_id>: Sets the group ownership. To get your group id, type id -g in the terminal.
_netdev: Ensures that the system waits for network connectivity before attempting to mount the share.
0 0: Dump and fsck options (usually set to 0).

5. Test the Mount:
After saving /etc/fstab, test the mount without rebooting:
sudo mount -a
If there are no errors, your Samba share should be mounted.

Important Notes:
Security: Storing credentials in a separate file with restricted permissions is crucial for security.
Network Connectivity: The _netdev option is essential, especially for systems that rely on Wi-Fi.
Permissions: Ensure that the user and group IDs you specify match your local user and group. Incorrect permissions can lead to access problems.
Samba Version: The vers=3.0 option tries to use version 3.0 of the samba protocol. If you are using an older samba server, you may need to adjust this value.
Troubleshooting: If you encounter errors, check the system logs (/var/log/syslog or journalctl) for detailed information.

The things you do not tell us, are usually the clue to fixing the problem.
When I was a kid, I wanted to be older.
This is not what I expected :o

Clarity
Posts: 4235
Joined: Fri Jul 24, 2020 10:59 pm
Has thanked: 1814 times
Been thanked: 571 times

Re: AutoMOUNT resources from your home SAMBA server on your PC.

Post by Clarity »

Thanks @bigpup

The document, itself, has a very good layout. The PDF was sent to @wizard to help him, where I asked for his comment, as well, in the PM sent to him.

Again, the document was inspired to help a question raised by @JusGellin as his concern applies to many forum users. Many or most have a central LAN storage location that they use on the home network. It helps so that forum distro can auto-connect at boot time to the home places information is stored to be used by other home PC type connections.

Anyone can contribute here if a problem is seen or a correction is necessary. It, also, is hoped that this solution extends across all of the forum distro.

Comments welcomed about the solution and its use, as presented.

Clarity
Posts: 4235
Joined: Fri Jul 24, 2020 10:59 pm
Has thanked: 1814 times
Been thanked: 571 times

Re: AutoMOUNT resources from your home SAMBA server on your PC.

Post by Clarity »

Received a idea from a forum member. The documented was updated with a comment of interest to forum members at its beginning.

Structurally all other elements of the document remain, primarily, the same.

If anyone discover an issue or have other ideas for improvements in the document, please advise.

The document is available to anyone via its link and poses no security concern to anyone.

Anyone who can make-narrate a video of the steps, PLEASE, post a link on this thread to help others.

Post Reply

Return to “Network/Server”