# Setting up samba

**URL:** <https://community.learnlinux.tv/t/setting-up-samba/3818>\
**Category:** Homelab\
**Created:** [April 18, 2024, 7:55pm UTC](https://community.learnlinux.tv/t/setting-up-samba/3818 "2024-04-18T19:55:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mason64](https://community.learnlinux.tv/letter_avatar_proxy/v4/letter/m/3d9bf3/32.png) [@mason64](https://community.learnlinux.tv/u/mason64)\
**Post date:** [April 18, 2024, 7:55pm UTC](https://community.learnlinux.tv/t/setting-up-samba/3818/1 "2024-04-18T19:55:42Z")

</div>

Following the topic below this (at the time of writing this)

What am i doing wrong?

i have set up a samba server and i already have one which works

the new one i have setup i just cant get access to it.

it keeps popping up asking for the username and password but the two users i have on the linux machine details dont seem to be working.

i get this

![image](https://community.learnlinux.tv/uploads/default/original/2X/d/d3e09143cebff5fde7127b6e1f9ea3fd4192f808.png)

i have a very basic conf file

[Companydata]  
comment = CompanyData  
path = /share/companydata/  
valid users = mason64 freddie  
read only = no  
browseable = yes  
writeable = yes  
create mask = 0644  
directory mask = 0775

Where am i going wrong - this works fine on my other vm with the same conf file so i dont understand where am going wrong.

I am just going to file explorer and typing \10.0.0.171\ or \10.0.0.171\companydata\ but both keep asking for the credentials.

Any help would be so grateful.

---

<div class="post-metadata">

**Author:** ![mason64](https://community.learnlinux.tv/letter_avatar_proxy/v4/letter/m/3d9bf3/32.png) [@mason64](https://community.learnlinux.tv/u/mason64)\
**Post date:** [April 18, 2024, 8:16pm UTC](https://community.learnlinux.tv/t/setting-up-samba/3818/2 "2024-04-18T20:16:08Z")

</div>

Think I answered my own question

I forgot to give the user a samba password using smbpasswd -a mason64

I guess that this has to be done for all users that want adding to samba ?

---

<div class="post-metadata">

**Author:** ![ThatGuyB](https://community.learnlinux.tv/user_avatar/community.learnlinux.tv/thatguyb/32/784_2.png) [@ThatGuyB](https://community.learnlinux.tv/u/ThatGuyB)\
**Post date:** [April 18, 2024, 8:40pm UTC](https://community.learnlinux.tv/t/setting-up-samba/3818/3 "2024-04-18T20:40:19Z")

</div>

> [@mason64](#):
>
> smbpasswd -a mason64
> 
> I guess that this has to be done for all users that want adding to samba ?

Yes. It’s been ages since I worked with samba, but I remember this needing to be done.

I prefer using linux groups in the samba config. Just add the group to the config and you only need to add the user to the group if you want them to gain access to a share. That was one of my proudest samba manageability improvements (compared to the way the previous guys were doing it, with symlinks in users home dirs, which broke very often and resulted in infinite loops in windows).

---

<div class="post-metadata">

**Author:** ![mason64](https://community.learnlinux.tv/letter_avatar_proxy/v4/letter/m/3d9bf3/32.png) [@mason64](https://community.learnlinux.tv/u/mason64)\
**Post date:** [April 18, 2024, 10:05pm UTC](https://community.learnlinux.tv/t/setting-up-samba/3818/4 "2024-04-18T22:05:59Z")

</div>

Thanks for the reply

Sorry to ask but could you show me an example if you get time?

---

<div class="post-metadata">

**Author:** ![ThatGuyB](https://community.learnlinux.tv/user_avatar/community.learnlinux.tv/thatguyb/32/784_2.png) [@ThatGuyB](https://community.learnlinux.tv/u/ThatGuyB)\
**Post date:** [April 19, 2024, 1:18am UTC](https://community.learnlinux.tv/t/setting-up-samba/3818/5 "2024-04-19T01:18:36Z")

</div>

[https://www.samba.org/samba/docs/4.7/man-html/smb.conf.5.html](https://www.samba.org/samba/docs/4.7/man-html/smb.conf.5.html)

(look after “valid users =”)

```auto
sudo groupadd financial
sudo chgrp -R financial /mnt/finances
sudo usermod -a -G financial eddiebrown
sudo smbpasswd -a eddiebrown
sudo smbpasswd -e eddiebrown
sudo nano /etc/samba/smb.conf

```

Add the share “finances” with the valid user set to a group (the “@” symbol represents a group - you can add both multiple groups and multiple users on the same line).

> [finances]  
> path = /mnt/finances  
> browsable = yes  
> writable = yes  
> guest ok = no  
> read only = no  
> valid users = `@financial`

```auto
sudo systemctl restart smbd

```

After this, any individual you add to the “financial” group on the system will be able to access the “finances” share, without you having to modify the config and I’m pretty sure without needing to restart samba, just a `usermod` away.

---

<div class="post-metadata">

**Author:** ![mason64](https://community.learnlinux.tv/letter_avatar_proxy/v4/letter/m/3d9bf3/32.png) [@mason64](https://community.learnlinux.tv/u/mason64)\
**Post date:** [April 19, 2024, 7:56am UTC](https://community.learnlinux.tv/t/setting-up-samba/3818/6 "2024-04-19T07:56:46Z")

</div>

hey

thats brilliant thank you so much for taking the time out to help with that.

Thanks  
Dave
