How to setup Samba on Fedora the easy way?

I’m on Fedora 29 and I would like to learn how to setup Samba so I can connect to a Windows share directly from Nautilus by going to other locations → windows network.

3 Likes

Hello @delacosta78 what is the problem specifically? :slight_smile:
In Files (Nautilus) in Other Locations → Connect to Server → smb://host.lan/Share/

2 Likes

I wasn’t able to connect the way you explain but it works now, however, can you please teach me how to share a folder from my linux system so I can access it from other computers and devices?, I have an Android TV device where I need to access a folder to install some APKs but I still haven’t found the way to share that folder.

1 Like

@delacosta78 @alciregi Have a nice day!!

** it’s a need to open firewalld for share for samba, ans make sure /etc/samba/smb.conf
** Setting Samba Service (Applying Real Service)

  1. samba => Create a samba-specific account.
    a. Create a samba account and manage it centrally through a single account.
    b. All Samba accounts for regular users are added and managed through smbpasswd.

  2. Add Samba user and set Samba login password “Just sample User => simmon”
    smbpasswd -a “Samba user account”

    [root@nalkal simmon]# dnf install samba*
    [root@nalkal simmon]# smbpasswd -a simmon
    New SMB password:
    Retype new SMB password:
    Added user simmon.
    
  3. Allow and set the samba port (samba port 139,445)

    [root@nalkal simmon]# firewall-cmd --permanent --zone=public --add-port=139/tcp
    success
    [root@nalkal simmon]# firewall-cmd --permanent --zone=public --add-port=445/tcp
    success
    [root@nalkal simmon]#  firewall-cmd --reload
    success
    
  4. Configuring the samba Environment
    Allow directories to share specify the storage location as /home/share, and also use the user account.

    a. Public place samba setting

    [root@nalkal simmon]# mkdir /home/share
    [root@nalkal simmon]# chmod 777 /home/share
    

    b. Preferences ( /etc/samba/smb.conf )

    [smbshare]
    comment = samba service
    path = /home/share
    public = yes
    writable = yes
    write list = samba
    create mask = 0777
    directory mask = 0777
    
  5. Service Settings

    [root@nalkal samba]# systemctl enable smb
    Created symlink /etc/systemd/system/multi-user.target.wants/smb.service → /usr/lib/systemd/system/smb.service.
    [root@nalkal samba]# systemctl start smb
     ● smb.service - Samba SMB Daemon
    Loaded: loaded (/usr/lib/systemd/system/smb.service; enabled; vendor preset: disabled)
    Active: active (running) since Fri 2019-07-19 02:34:54 KST; 2min 57s ago
    Docs: man:smbd(8)
        man:samba(7)
        man:smb.conf(5)
    Main PID: 9218 (smbd)
    Status: "smbd: ready to serve connections..."
     Tasks: 4 (limit: 1141)
     Memory: 13.7M
     CGroup: /system.slice/smb.service
           ├─9218 /usr/sbin/smbd --foreground --no-process-group
           ├─9220 /usr/sbin/smbd --foreground --no-process-group
           ├─9221 /usr/sbin/smbd --foreground --no-process-group
           └─9222 /usr/sbin/smbd --foreground --no-process-group
    
    7월 19 02:34:54 nalkal systemd[1]: Starting Samba SMB Daemon...
    7월 19 02:34:54 nalkal systemd[1]: Started Samba SMB Daemon.
    7월 19 02:34:54 nalkal smbd[9218]: [2019/07/19 02:34:54.599592,  0] ../../lib/util/become_daemon.c:135(daemo>
    7월 19 02:34:54 nalkal smbd[9218]:   daemon_ready: daemon 'smbd' finished starting up and ready to serve con>
    

~

  1. just use in user login and it can be a change for smbpasswd

    [simmon@nalkal ~]$ smbpasswd
    Old SMB password:
    New SMB password:
    Retype new SMB password:
    Password changed for user simmon
    

F30 Server with KDE System

written by simmon
simmon@nplob.com

@simmon is that the easy way? :grin:

Anyway, why /home/share? I want to share the downloads folder, what should I do?, I’m confused.

How can I use my own user, the one I use to login to my system?

I just want to share the /home/myusername/Downloads folder using my own user, the one I use to login to my fedora desktop.

it’s a just sample folder…change other folder…for use …!!

I just did this:

[Downloads]
comment = samba service
path = /home/myusername/Downloads
public = yes
writable = yes
write list = samba
create mask = 0777
directory mask = 0777

Now I need to set “myusername”, as the Samba user, how can I do it?

basically…user folder share for samba…within my write articles.
so, did you add samba user like a "smbpasswd -a myusername " ?

I just did but Nautilus now says: “You do not have enough permissions to see the content of Downloads”…

Am I missing something?

chmod 755 "${HOME}"
chmod 777 "$(xdg-user-dir DOWNLOAD)"
1 Like

yea…h…it’s change permission for samba user…and it’ll be access and share it.

# chmod 777 /home/share  or # chmod 755 /home/share 

Thanks comment @vgaetera … it’s a good to use and can be change other permission

Have a nice day!

simmon@nplob.com

1 Like

I only did # chmod 777 /home/myusername/Downloads but I still can’t access it.

I have to add this to the samba config file?

did you set up firewalld, also it’s a need to open port for samba, and please check disable selinux?

Copy both commands into the terminal under your session.
An unprivileged Samba user should have access to the whole directory chain recursively starting from the filesystem root.

Didn’t work.

Why is this so complicated?

Is there any GUI I could use instead?

Ok, let’s recap, I want to share the /home/myusername/Downloads folder so I could access it from a Windows 10 computer and an Android TV device, could someone please provide the step by step commands to make this work in one single reply?, thanks.

SMB_SHARE="$(xdg-user-dir PUBLICSHARE)"
sudo dnf install samba
sudo tee --append /etc/samba/smb.conf << EOF > /dev/null
[public]
path = ${SMB_SHARE}
guest ok = yes
writeable = yes
EOF
sudo systemctl --now enable smb.service
sudo firewall-cmd --permanent --add-service="samba"
sudo firewall-cmd --reload
mkdir --parents "${SMB_SHARE}"
chmod "u=rwX,g=rX,o=rX" "${SMB_SHARE}/.."
chmod --recursive "u=rwX,g=rwX,o=rwX" "${SMB_SHARE}"
sudo semanage fcontext --add --type "samba_share_t" "${SMB_SHARE}(/.*)?"
sudo restorecon -R "${SMB_SHARE}"
nautilus smb://localhost/public

Although have no Windows to test, it works for me on Fedora 30.

3 Likes

I don’t want to sound rude but… Where is the /home/myusername/Downloads folder in there???

To be able to understand what you are doing, I need to see those steps as if you were doing them in my computer…