SMB Shared Drives, tips from me just wasting way too long trying to get mine to work

in #linux5 years ago (edited)

This post is mainly for future me to read when it all breaks again.

SMB?

SMB is a protocol for shared folders, and can be used with Windows. You can use this to have a linux server hooked up to some external hard drivers that any pc in your house can use.

Samba is software on linux that lets you use the SMB protocol.

Once you get samba installed, if nothing is working, check out these tips.

I am very inexperienced with linux, so some of these tips may seem obvious.

Tips

My smb.conf file:

[global]
    workgroup = WORKGROUP
    server role = standalone server

    hosts allow = 127. 192.168.

    null passwords = yes
    map to guest = Bad Password
    guest ok = yes

    wins support = yes
    local master = yes
    preferred master = yes

[Backup]
    comment = Backup Drive
    path = /mnt/backup
    valid users = ajay
    read only = no
    writeable = yes
    create mask = 0777
    directory mask = 0777
    force user = ajay

Set workgroup to WORKGROUP to sync up with Windows PCs, it's the default workgroup on Windows.

Make sure to allow the IPs you are connecting from.

If you are allowing guests, make sure to include map to guest = Bad Password

There are some commands that you need to use to make sure permissions are set up correctly so the shared drive can be accessed:

chmod 0755 [folder name]
chown :[group name] [folder name]
chcon -Rt samba_share_t [shared folder goes here] <- This is the one that seems to be found nowhere on the internet.

And if all else fails, something which I wish I knew before, disabling SElinux can make these permission checks never even occur.

One other thing, you may have to enable SMB features in the Turn Windows Features On And Off panel.
image.png
Mine seems to have disabled itself for some reason, but it still works, so only do this if nothing works.

If you want to make it so only one user can access the share, add the user with smbpasswd -a [name] and add valid users = [name] to your share settings in the config.

Unrelated tip:

Best way to auto turn off the display after 1 minute

setterm --blank 1
You can't do this over ssh, you must have access to the pc.

Coin Marketplace

STEEM 0.18
TRX 0.18
JST 0.033
BTC 87961.61
ETH 3064.38
USDT 1.00
SBD 2.71