0

I'm trying to set up a samba share to a computer that only I will have access to. I need full access to this computer from my windows machine. I am the only person using either machine, and I need full read/write access to the share.

I tried this so far, and I can SEE the folders/files from my windows machine, but I can't edit any of the files.

My code will be on the linux machine, and I will use my windows laptop to code on it.

  1. My windows username is just my email, let's call it my_email@gmail.com
  2. There is no workgroup (it's just WORKGROUP).
  3. My linux installation user is "expert" (ironic, I know)
  4. I'm using Debian 9 (stretch). Just installed today from: debian-9.4.0-amd64-netinst.iso. Used KDE.

Here is my smb.conf (comments removed, print sections removed)

[global]
;   wins server = w.x.y.z
;   interfaces = 127.0.0.0/8 eth0
;   bind interfaces only = yes
   log file = /var/log/samba/log.%m
   max log size = 1000
   syslog = 0
   panic action = /usr/share/samba/panic-action %d
   server role = standalone server
   passdb backend = tdbsam
   obey pam restrictions = yes
   unix password sync = yes
   passwd program = /usr/bin/passwd %u
   passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
   pam password change = yes
   map to guest = bad user

########## Domains ###########
;   logon path = \\%N\profiles\%U
;   logon drive = H:
;   logon script = logon.cmd
; add user script = /usr/sbin/adduser --quiet --disabled-password --gecos "" %u
; add machine script  = /usr/sbin/useradd -g machines -c "%u machine account" -d /var/lib/samba -s /bin/false %u
; add group script = /usr/sbin/addgroup --force-badname %g

############ Misc ############
;   include = /home/samba/etc/smb.conf.%m
;   idmap uid = 10000-20000
;   idmap gid = 10000-20000
;   template shell = /bin/bash
;   usershare max shares = 100
   usershare allow guests = yes

#======================= Share Definitions =======================

[homes]
   comment = Home Directories
   browseable = no
   read only = yes
   create mask = 0700
   directory mask = 0700
   valid users = %S

[Share]
   comment = Full Access Share
   path = /home/expert/Projects/expert
   browseable = yes
   writable = yes
   public = yes
   guest ok = yes
   read only = no
   create mask = 0777
   directory mask = 0777
   write list = 0777
   valid users = nobody, admin, expert, anonymous, my_email@gmail.com

When I do ls -ld . on the folder where I want to have full access, I get:

drwxrwxrwx 3 expert expert 4096 <date time> .

I thought by giving it create, directory masks and write lists as 0777 I would give full control to Samba.

The last line (valid users) was just a shot in the dark from me (didn't work)

migrated from askubuntu.com May 1 '18 at 15:16

This question came from our site for Ubuntu users and developers.

  • I have found that I need the line encrypt passwords = true in the global section of smb.conf – Charles Green May 1 '18 at 15:29
  • I have seen where changing or setting the vers= part of the mount command to 1.0 will work. However, that is telling it to use SMBv1. SMBv1 is very vulnerable and should not be used. Try setting your Windows system that is serving the files to SMBv2 or SMBv3. I would recommend SMBv3. See: support.microsoft.com/en-us/help/2696547/… – Terrance May 1 '18 at 15:50
0

A couple of things that may help in getting an answer to your question.

How did you install samba? from repos? What version is it? samba --version

What Windows are you using? Can you connect from linux?

A couple of issues that you may want to address one at a time. Setup the samba with a minimum set of config entries. Be mindful of the defaults for you samba version. Build on a working installation.

Windows when connecting to a SMB share may send your login user name, guest, no user name, or other user name.

Determin what info is being passed from Windows to Linux samba.

You can check your samba user setup from the linux command line with smbclient //host/share -U username before you dig into what Windows is sending.

Are these users in the password backend?

valid users = nobody, admin, expert, anonymous, my_email@gmail.com

passdb backend = tdbsam

Creating a Local User Account

pdbedit -- manage the SAM database

Don't forget to restart the samba server bits after changing smb.conf...

sudo service smbd restart

sudo service nmbd restart

May want to start with a wide open share setup, then build on it.

[global]
    server string = This is: %h. Welcome.
    workgroup = workgroup
    netbios name = hostname
    encrypt passwords = yes

    ## permissions
    server role = standalone
    security = user
    null passwords = yes
    map to guest = Bad Password
    guest ok = yes
    guest account = nobody

    # debug Adjust for trouble shooting
    log level = 2

# the IPC$ connection that lists the shares is done as guest and so you must have a valid guest account.
[IPC$]
    path = /tmp

[lookie]
    comment = open share on %h
    path = /samba/share/lookie
    # all files copied to this share have full r/w to all
    create mask = 0777
    delete readonly = yes
    ## This user must have read/write to the share directory
    ## May require R/W for the full path up to the share. Check.
    force user = expert
    read only = No
    browseable = yes
  • Samba version is 4.5.12-Debian. Installed by sudo apt-get install samba, using Windows 10, not sure if I can see the windows install from the linux virtual machine, but the windows install can see the linux virtual machine files all right, just can't edit them. When I try sudo smbclient //host/share -U expert I get "WARNING: The "syslog" option is deprecated" and then after password I get "Connection to host failed (Error NT_STATUS_UNSUCCESSFUL)" – Mormoran May 2 '18 at 8:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.