You are not logged in.

#1 2015-02-13 17:47:41

Llama
Banned
From: St.-Petersburg, Russia
Registered: 2008-03-03
Posts: 1,379

[SOLVED] Creating Samba Server and Mounting Samba Share

Hi,

I've got a home LAN consisting of a box, a laptop, and a hardware router. A box I've configured as a samba server as best I could: just followed the Wiki, default configuration; now I have a bit of a trouble appreciating my handiwork on the client (laptop) side.

Server side info($ testparm):

$ testparm 
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[homes]"
Processing section "[printers]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions

[global]
        workgroup = MYGROUP
        server string = Samba Server
        log file = /var/log/samba/%m.log
        max log size = 50
        printcap name = /etc/printcap
        dns proxy = No
        idmap config * : backend = tdb

[homes]
        comment = Home Directories
        read only = No
        browseable = No

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

Client side ($ smbclient -L stovepipebox -U%):

$ smbclient -L stovepipebox -U%
Domain=[MYGROUP] OS=[Unix] Server=[Samba 4.1.16]

        Sharename       Type      Comment
        ---------       ----      -------
        IPC$            IPC       IPC Service (Samba Server)
Domain=[MYGROUP] OS=[Unix] Server=[Samba 4.1.16]

        Server               Comment
        ---------            -------

        Workgroup            Master
        ---------            -------
$

Meanwhile, Wiki suggests mounting my share this way:

# mount -t cifs //SERVER/sharename /mnt/mountpoint -o user=username,password=password,workgroup=workgroup,ip=serverip

I have trouble placing SERVER and sharename for starters. Does it look like server configuration is somewhat deficient? Sorry, this is my first experience with samba smile .

There's samba_user on server, too:

$ smbclient -L stovepipebox -U samba_user
Enter samba_user's password: 
Domain=[MYGROUP] OS=[Unix] Server=[Samba 4.1.16]

        Sharename       Type      Comment
        ---------       ----      -------
        IPC$            IPC       IPC Service (Samba Server)
        samba_user      Disk      Home Directories
Domain=[MYGROUP] OS=[Unix] Server=[Samba 4.1.16]

        Server               Comment
        ---------            -------

        Workgroup            Master
        ---------            -------
$ 

Is it enough to suggest the mount command parameters?

Last edited by Llama (2015-02-16 13:28:13)

Offline

#2 2015-02-15 08:05:11

Llama
Banned
From: St.-Petersburg, Russia
Registered: 2008-03-03
Posts: 1,379

Re: [SOLVED] Creating Samba Server and Mounting Samba Share

Discovered Samba Tips and Tricks and streamlined a bit my frustration. Current state of affairs:

1. /etc/hosts:

#
# /etc/hosts: static lookup table for host names
#

#<ip-address>	<hostname.domain.org>	<hostname>
127.0.0.1	localhost.localdomain	localhost
::1		localhost.localdomain	localhost
192.168.1.33               alfabox.localdomain alfabox
192.168.1.34               bravobox.localdomain bravobox

# End of file

2. /etc/samba/smb.conf:

[global]
    workgroup = WORKGROUP
    server string = Samba Server
    netbios name = SERVER
    name resolve order = bcast host
    dns proxy = no

    log file = /var/log/samba/%m.log

    create mask = 0664
    directory mask = 0775

    force create mode = 0664
    force directory mode = 0775

    ; One may be interested in the following setting:
    ;force group = +nas

[media1]
    path = /home/alexey
    read only = No

3. Got a samba user on the server box: samba_user. I have no idea how to utilize it, though.
4. Discovered that the mounting problem looks exactly the same on the server box, so experimenting is limited so far to the server box.

alexey@alfabox ~ $ smbclient -L alfabox -U%
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 4.1.16]

        Sharename       Type      Comment
        ---------       ----      -------
        media1          Disk      
        IPC$            IPC       IPC Service (Samba Server)
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 4.1.16]

        Server               Comment
        ---------            -------
        SERVER               Samba Server

        Workgroup            Master
        ---------            -------
        WORKGROUP            SERVER

5. An attempt at mounting:

alexey@alfabox ~ $ sudo mount -t cifs //alfabox/media1 /mnt/ss
Password for root@//alfabox/media1: 
mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
alexey@alfabox ~ $ sudo mount -t cifs //192.168.1.33/media1 /mnt/ss
Password for root@//192.168.1.33/media1: 
mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
alexey@alfabox ~ $ 

No password I can think of is good enough. What am I missing? Yes, I want to share r/w my entire home directory, passworded.

Last edited by Llama (2015-02-15 08:09:52)

Offline

#3 2015-02-15 17:55:20

Soukyuu
Member
Registered: 2014-04-08
Posts: 854

Re: [SOLVED] Creating Samba Server and Mounting Samba Share

The samba user you are using has to have read access to the folder you are sharing on your server box. If you share /home/usera and try to access it with samba_user, you won't be able to access it - because your home folder is usually set to be only accessible by your user account only.

edit:

You should be using the wiki way of mounting it, by specifying user and password, not the root password. I suggest you read through the samba wiki article again, creating samba users and how to use them is described there.

What I do is create a samba user for every user account on the server (same name) that needs access to shares. That way my smb users have the same access rights as the local ones. All of them are part of the sambashare group, so if I want to share a folder the user usually doesn't have access to, I just set the group of that folder to sambashare and create the share on the server. All of this is described in the wiki article.

Last edited by Soukyuu (2015-02-15 18:06:43)


[ Arch x86_64 | linux | Framework 13 | AMD Ryzen™ 5 7640U | 32GB RAM | KDE Plasma Wayland ]

Offline

#4 2015-02-16 13:24:57

Llama
Banned
From: St.-Petersburg, Russia
Registered: 2008-03-03
Posts: 1,379

Re: [SOLVED] Creating Samba Server and Mounting Samba Share

Thanks, SouKyuu!

Yes, my server Linux account need not be anything special smile . I didn't get it.

Step by step instruction, like (lest I shoud forget it all):

Purpose: make a single r/w share of an entire user directory (alexey)
available via samba password

SERVER:

Create Samba user account:

$ sudo pdbedit -a -u alexey   ;; note that alexey is an existing Linux user

Delete Samba user account (e.g. created by mistake):

$ sudo pdbedit -x samba_user
$ sudo userdel samba_user         ;; if not needed - no suicide!

/etc/samba/smb.conf:

[global]
    workgroup = WORKGROUP
    server string = Samba Server
    netbios name = SERVER
    name resolve order = bcast host
    dns proxy = no

    log file = /var/log/samba/%m.log

    create mask = 0664
    directory mask = 0775

    force create mode = 0664
    force directory mode = 0775

    ; One may be interested in the following setting:
    ;force group = +nas

[alexey]
    path = /home/alexey
    read only = No

Starting:

$ sudo systemctl start smbd nmbd


CLIENT:

Check (alfabox is the server host name; IP address will do, too):

$ smbclient -L alfabox -U%                          
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 4.1.16]

        Sharename       Type      Comment
        ---------       ----      -------
        alexey          Disk      
        IPC$            IPC       IPC Service (Samba Server)
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 4.1.16]

        Server               Comment
        ---------            -------
        SERVER               Samba Server

        Workgroup            Master
        ---------            -------
        WORKGROUP
        
Manual mount (pwd from $ sudo pdbedit -a -u alexey ;; server side):

$ sudo mount -t cifs //SERVER/alexey /mnt/stove -o user=alexey,password=pwd,workgroup=WORKGROUP,ip=192.168.1.33

Routine mount:

.smbcredentials (plain text, basic security):

username=alexey
password=pwd

$ sudo chown root:root /home/alexey/.smbcredentials
$ sudo chmod 660 /home/alexey/.smbcredentials


/etc/fstab:

//192.168.1.33/alexey /mnt/stove cifs credentials=/home/alexey/.smbcredentials,comment=systemd.automount,uid=alexey 0 0

Offline

Board footer

Powered by FluxBB