Friday, September 4, 2020

Samba Trying To Find The Perfect Simple Setup (It Works)

When logging on from Windows to Linux 
Try this . . . If Windows rejects credentials
Use your Microsoft email address
User:MicrosoftAccount\me@email.com
Example: you are Bob and your Microsoft email is BobBarker@live.com and your local PC password is 1234
Enter Bob/BobBarker@live.com - 1234
It works even if you are running Windows with local account.
I know - It's crazy
Permissions to do anything is another subject but at lease you can see stuff.



Let's be honest . . . If you are setting up Samba like this you only want to share a file or two. 
... A better option might be NitroShare but . . . it can be a challenge to install on some distros and it is out of development.
...... Why not use ssh . . . with Putty and WinSCP (both available with Symenu)

But if you just want this dang thing to work . . . Try this:
*Hint for editing smb.conf
... Nano works fine but running Thunar as root (sudo thunar) works better.

Mint installs a Samba folder containing smb.conf but Samba is not installed out of the box.
This differs with the distributions. Manjaro has Samba installed but no smb.conf. MX has Samba installed and a GUI setup.

Install Samba (sudo apt-get install samba)

Existing smb.conf  [global] settings may need no alterations unless you have long netbios name. 
(Some day I want to figure out what are bare bones essentials in [global] )

Maybe this:
[global]
server string = My Server
workgroup = WORKGROUP
security = user
map to guest = Bad User
name resolve order = bcast host

Just add this to bottom of smb.conf

[share]
path = /home/share
#case sensitive, choose any directory
hosts allow = 192.168.1.0/24
hosts deny = 0.0.0.0/0
browseable = yes 
guest ok = yes 
guest only = yes
read only = no

#the following is not necessary. Permissions on the folder overrides the following anyway.
force user = nobody
force create mode = 0777
force directory mode = 0777

(fyi - I think "guest ok = yes" and "chmod -R 0777" the share folder is the key)

sudo systemctl restart smbd
sudo systemctl restart nmbd
sudo service smbd restart
sudo service nmbd restart
(nmbd will broadcast to the Windows network)

testparm to check for errors

sudo mkdir -p /home/share   (matches choice above)

sudo chmod -R 0777 /home/share

sudo chown -R yourname /home/share

Check Shares    sudo smbstatus --shares

Running smb allows access to share by ip address
Running nmb allows netbios to find and show share in Windows file manager
Starting smb and nmb will not make smb/nmb available on reboot
... Use also "sudo systemctl enable smb" - likewise nmb
...

For Manjaro I copied the Mint smb.conf used above and did the same steps.
I think the Mint smb.conf is the default smb.conf file for Samba in most distributions.
In Manjaro Samba is already installed but not the smb.conf so create one.
You can get the Manjaro smb.conf here if needed but it is not the standard one.
Everything worked. 
Drop Dead Simple
Remember Debian & Arch have different syntax - Deb = systemctl start smbd vx Arch = smb
Remember to sudo systemctl enable smb

...

For PopOS nothing has worked yet. I still always get this . . .
- And yes, this is why I hate Samba


Ok - I got it. I had added a  ;comment in a command line but it didn't show a problem in testparm. You can add a ;comment but on its own line.

I am leaving this link for info but found better way
https://www.youtube.com/watch?v=7Q0mnAT1MRg&t=126s

Caveat = Changes keep happening in Operating Systems. What works today may work tomorrow.
Caveat #2 = Windows 10 likes to add this connection to your "Quick Access" file. If your windows folders don't refresh properly just delete 
%AppData%\Microsoft\windows\recent\automaticdestinations
or try doing standard clear . . .



Additional thoughts -
Permissions and Ownership are critical so chown and chmod familiarity is essential and easy after a few rounds and battles.



No comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Pin Not Available

Crazy Error I had not seen before. Pin not available blah blah. I restarted a few times and it finally worked. If it doesn't some say to...