Page 1 of 2

ARRRRGGGHHHH Its happened again! - Lost Samba settings

Posted: Fri Sep 13, 2019 1:00 pm
by doubleudee1
Had to reload everything through a lockup with raspian, now I'm at a point where i can see my directory on the Pi from windows 10, but it says 'windows cannot access 'mydir' please check spelling or network blah blah blah....'

If someone can help heres my main files:-
my entry in 'sudo nano /etc/samba/smb.conf'

Code: Select all

#======================= Global Settings =======================

[global]
   workgroup = WORKGROUP
   wins support = yes
###################################

#### Debugging/Accounting ####
   log file = /var/log/samba/log.%m
   max log size = 1000
  logging = file
  panic action = /usr/share/samba/panic-action %d
#################################

####### Authentication #######
   server role = standalone server
  obey pam restrictions = yes
   unix password sync = yes
  pam password change = yes

########## Domains ############


############ Misc ############
   usershare allow guests = yes
####### Share Definitions############
[homes]
   comment = Home Directories
   browseable = yes
   read only = no
  create mask = 0775
   directory mask = 0775
  valid users = %S
###################
[printers]
   comment = All Printers
   browseable = no
   path = /var/spool/samba
   printable = yes
   guest ok = no
   read only = yes
   create mask = 0700
#########
[CCTV_In]
comment =  Incoming File From CCTV Camerass
path = /home/pi/CCTV_In     ## added for 4TB HDD
writeable = Yes
create mask = 0777
directory mask = 0777
browseable = Yes
public = yes
guest ok = yes
###########
[print$]
   comment = Printer Drivers
   path = /var/lib/samba/printers
   browseable = yes
   read only = yes
   guest ok = no
################################Original Version#####################################



#####################################################################################
Entry in /etc/fstab/

Code: Select all

proc            /proc           proc    defaults          0       0
/dev/mmcblk0p6  /boot           vfat    defaults          0       2
/dev/mmcblk0p7  /               ext4    defaults,noatime  0       1
/dev/sda1       /home/pi/CCTV_In       ntfs-3g  defaults         0       0

############################################################################################

sudo blkid
/dev/mmcblk0p1: LABEL_FATBOOT="RECOVERY" LABEL="RECOVERY" UUID="90E6-4AE3" TYPE="vfat" PARTUUID="0005231f-01"
/dev/mmcblk0p5: LABEL="SETTINGS" UUID="7ae383d9-d8c7-4cc1-844a-930d11d80aab" TYPE="ext4" PARTUUID="0005231f-05"
/dev/mmcblk0p6: LABEL_FATBOOT="boot" LABEL="boot" UUID="1454-1ACE" TYPE="vfat" PARTUUID="0005231f-06"
/dev/mmcblk0p7: LABEL="root" UUID="08ed55eb-a878-4b2a-b591-c7d46c4e3223" TYPE="ext4" PARTUUID="0005231f-07"
/dev/sda1: LABEL="CCTV" UUID="5E4224413DFC90AF" TYPE="ntfs" PTTYPE="dos" PARTLABEL="CCTV_In" PARTUUID="e6f57426-bfa1-4dee-b9e2-456699b0a57e"
/dev/mmcblk0: PTUUID="0005231f" PTTYPE="dos"
############################################################################################
I've googled until my fingers hurt and tried looking back at previous notes I made, to no avail.
I know it's a basic mistake somewhere, my external HDD is definately mounted where it should be, but still?
Any help please?

Re: ARRRRGGGHHHH Its happened again!

Posted: Fri Sep 13, 2019 1:06 pm
by LTolledo
did you make a samba password ?

Re: ARRRRGGGHHHH Its happened again!

Posted: Fri Sep 13, 2019 1:31 pm
by doubleudee1
Yes
Samba password made using
sudo smbpasswd -a pi

then entered pwd twice

Re: ARRRRGGGHHHH Its happened again!

Posted: Fri Sep 13, 2019 1:37 pm
by doubleudee1
Just ran this:-

Code: Select all

sudo systemctl status smbd.service
● smbd.service - Samba SMB Daemon
   Loaded: loaded (/lib/systemd/system/smbd.service; enabled; vendor preset: ena
   Active: active (running) since Fri 2019-09-13 12:36:37 BST; 9min ago
     Docs: man:smbd(8)
           man:samba(7)
           man:smb.conf(5)
  Process: 4069 ExecStartPre=/usr/share/samba/update-apparmor-samba-profile (cod
 Main PID: 4070 (smbd)
   Status: "smbd: ready to serve connections..."
    Tasks: 4 (limit: 2200)
   Memory: 4.1M
   CGroup: /system.slice/smbd.service
           ├─4070 /usr/sbin/smbd --foreground --no-process-group
           ├─4072 /usr/sbin/smbd --foreground --no-process-group
           ├─4073 /usr/sbin/smbd --foreground --no-process-group
           └─4074 /usr/sbin/smbd --foreground --no-process-group

Sep 13 12:36:37 raspberrypi systemd[1]: Starting Samba SMB Daemon...
Sep 13 12:36:37 raspberrypi systemd[1]: Started Samba SMB Daemon.

[1]+  Stopped                 sudo systemctl status smbd.service
Not sure what this means [1]+ Stopped sudo systemctl status smbd.service ?

Re: ARRRRGGGHHHH Its happened again!

Posted: Fri Sep 13, 2019 2:42 pm
by ejolson
doubleudee1 wrote:
Fri Sep 13, 2019 1:37 pm
Just ran this:-

sudo systemctl status smbd.service
● smbd.service - Samba SMB Daemon
Loaded: loaded (/lib/systemd/system/smbd.service; enabled; vendor preset: ena
Active: active (running) since Fri 2019-09-13 12:36:37 BST; 9min ago
Docs: man:smbd(8)
man:samba(7)
man:smb.conf(5)
Process: 4069 ExecStartPre=/usr/share/samba/update-apparmor-samba-profile (cod
Main PID: 4070 (smbd)
Status: "smbd: ready to serve connections..."
Tasks: 4 (limit: 2200)
Memory: 4.1M
CGroup: /system.slice/smbd.service
├─4070 /usr/sbin/smbd --foreground --no-process-group
├─4072 /usr/sbin/smbd --foreground --no-process-group
├─4073 /usr/sbin/smbd --foreground --no-process-group
└─4074 /usr/sbin/smbd --foreground --no-process-group

Sep 13 12:36:37 raspberrypi systemd[1]: Starting Samba SMB Daemon...
Sep 13 12:36:37 raspberrypi systemd[1]: Started Samba SMB Daemon.

[1]+ Stopped sudo systemctl status smbd.service


Not sure what this means [1]+ Stopped sudo systemctl status smbd.service ?
There can be compatibility problems with different versions of Windows. Can you connect using smbclient on the Pi?

Try something like

Code: Select all

$ smbclient -W WORKGROUP -U pi //localhost/pi
to see if it works or what the error message might be.

Re: ARRRRGGGHHHH Its happened again! - Lost Samba settings

Posted: Fri Sep 13, 2019 3:15 pm
by doubleudee1
This is what I get running that command
pi@raspberrypi:~ $ sudo smbclient -W WORKGROUP -U pi //localhost/pi
sudo: smbclient: command not found

and without sudo first:-
pi@raspberrypi:~ $ smbclient -W WORKGROUP -U pi //localhost/pi
-bash: smbclient: command not found

Re: ARRRRGGGHHHH Its happened again! - Lost Samba settings

Posted: Fri Sep 13, 2019 3:41 pm
by doubleudee1
Tried changing samba password and rebooting pi and PC but still wont let me in, looks like a full re-install for me.

Re: ARRRRGGGHHHH Its happened again! - Lost Samba settings

Posted: Fri Sep 13, 2019 7:19 pm
by hortimech
You posted " 'windows cannot access 'mydir' ", but you do not have a share called 'mydir'

To use smbclient, you will have to install it, 'sudo apt-get install smbclient'

After you install it, try this:

Code: Select all

smbclient -L -N

Re: ARRRRGGGHHHH Its happened again! - Lost Samba settings

Posted: Sat Sep 14, 2019 10:24 am
by doubleudee1
sorry, by mydir as was referring to my actual dir which is 'CCTV_In'.

I've just loaded 'sudo apt-get install smbclient', I thought all the stuff to do with Samba would have been loaded together?
Thanks, will start checks again.

ran that code and got
smbclient -L -N
Unable to initialize messaging context
do_connect: Connection to -N failed (Error NT_STATUS_UNSUCCESSFUL)

Re: ARRRRGGGHHHH Its happened again! - Lost Samba settings

Posted: Sat Sep 14, 2019 10:28 am
by DougieLawson
Run testparm to confirm that samba is using the config you think it should be using.

Code: Select all

dougie@apollo:~$ testparm
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
WARNING: The "syslog" option is deprecated
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
WARNING: The "syslog" option is deprecated
Processing section "[homes]"
Processing section "[shared]"
Processing section "[srv]"
Processing section "[shared_music]"
Loaded services file OK.

Server role: ROLE_STANDALONE

Press enter to see a dump of your service definitions


Re: ARRRRGGGHHHH Its happened again! - Lost Samba settings

Posted: Sat Sep 14, 2019 11:29 am
by doubleudee1
here's the results:-

Code: Select all

 testparm
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[printers]"
Processing section "[CCTV_In]"
Processing section "[print$]"
Loaded services file OK.
Server role: ROLE_STANDALONE

Press enter to see a dump of your service definitions

# Global parameters
[global]
        log file = /var/log/samba/log.%m
        logging = file
        map to guest = Bad User
        max log size = 1000
        obey pam restrictions = Yes
        pam password change = Yes
        panic action = /usr/share/samba/panic-action %d
        passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
        passwd program = /usr/bin/passwd %u
        server role = standalone server
        unix password sync = Yes
        usershare allow guests = Yes
        wins support = Yes
        idmap config * : backend = tdb
        create mask = 0775
        directory mask = 0775
        read only = No
        valid users = %S


[printers]
        browseable = No
        comment = All Printers
        create mask = 0700
        path = /var/spool/samba
        printable = Yes
        read only = Yes


[CCTV_In]
        comment = Incoming File From CCTV Camerass
        create mask = 0777
        directory mask = 0777
        guest ok = Yes
        path = /home/pi/CCTV_In ## added for 4TB HDD


[print$]
        comment = Printer Drivers
        path = /var/lib/samba/printers
        read only = Yes
Also FYI:-
ls
'~CCTV' Desktop Downloads Music Public Videos
CCTV_In Documents MagPi Pictures Templates

Re: ARRRRGGGHHHH Its happened again! - Lost Samba settings

Posted: Sat Sep 14, 2019 11:40 am
by DougieLawson
When things fail what do you get in /var/log/samba/log.*?

Re: ARRRRGGGHHHH Its happened again! - Lost Samba settings

Posted: Sat Sep 14, 2019 11:46 am
by doubleudee1
Disk setup looking through gparted =

Partition = /dev/sda1
Name = CCTV_In
File System - ntfs
Mount Poit = /home/pi/CCTV_In
Label = CCTV
Size = 3.64
used = 180.93 MiB
Unused = 3.64 TiB
Flag = msfdata

Mounted on /home/pi/CCTV_In

Cheers

Re: ARRRRGGGHHHH Its happened again! - Lost Samba settings

Posted: Sat Sep 14, 2019 11:49 am
by doubleudee1
DougieLawson wrote:
Sat Sep 14, 2019 11:40 am
When things fail what do you get in /var/log/samba/log.*?
Sorry for being stupid but where is that file? I tried
sudu nano /var/log/samba/log
-bash: sudu: command not found

?
Thanks

Re: ARRRRGGGHHHH Its happened again! - Lost Samba settings

Posted: Sat Sep 14, 2019 11:53 am
by doubleudee1
oops should have been sudo, but all I get is an empty file?

Re: ARRRRGGGHHHH Its happened again! - Lost Samba settings

Posted: Sat Sep 14, 2019 12:29 pm
by epoch1970
Try "cd /var/log/samba/", "ls" and if you see log files, e.g. file1.log, do "cat file1.log" to read its contents.
If the files are compressed, e.g. file2.log.gz, do "zcat file2.log.gz"

Re: ARRRRGGGHHHH Its happened again! - Lost Samba settings

Posted: Sat Sep 14, 2019 1:13 pm
by doubleudee1
OK, thanks for that, there are files and I will go through them asap

Re: ARRRRGGGHHHH Its happened again! - Lost Samba settings

Posted: Sat Sep 14, 2019 1:15 pm
by hortimech
doubleudee1 wrote:
Sat Sep 14, 2019 10:24 am
sorry, by mydir as was referring to my actual dir which is 'CCTV_In'.

I've just loaded 'sudo apt-get install smbclient', I thought all the stuff to do with Samba would have been loaded together?
Thanks, will start checks again.

ran that code and got
smbclient -L -N
Unable to initialize messaging context
do_connect: Connection to -N failed (Error NT_STATUS_UNSUCCESSFUL)
Oops, and of course that should have been:

Code: Select all

smbclient -L localhost -N

Re: ARRRRGGGHHHH Its happened again! - Lost Samba settings

Posted: Sun Sep 15, 2019 9:10 am
by doubleudee1
OK further progress going through the Samba logs:-

Code: Select all

########################################
/var/log/samba $ ls
cores
log.
log.127.0.0.1
log.192.168.1.110
log.192.168.1.195
log.2a00_23c7_3c88_e601_1d0f_993d_a33c_a388
log.2a00_23c7_3c88_e601_742d_412c_a181_d244
log.2a00_23c7_3c88_e601_79b0_f3ca_d34b_606
log.2a00_23c7_3c88_e601_902e_14d6_a46f_d74b
log.2a00_23c7_3c88_e601_f81f_4d18_2d91_1515
log.billnbevs-pc
log.nmbd
log.raspberrypi
log.smbd

#########################SAMBA ERROR IN FILE /var/log/samba log.nmbd##############################
[2019/09/12 23:27:37.563567,  0] ../source3/nmbd/nmbd_browsesync.c:354(find_domain_master_name_query_fail)
  find_domain_master_name_query_fail:
  Unable to find the Domain Master Browser name WORKGROUP<1b> for the workgroup WORKGROUP.
  Unable to sync browse lists in this workgroup
##This fault was repeating itself over and over day by day.##########
.
######################Gooling the fault gave mr################################################
The parameters that you are looking for are:

local master = yes
perferred master = yes

These two should take care of your error messages concerning no master
browser. You may also want to consider using the following:

wins support = yes

This will allow your Samba server to function as a WINS server for your
network.
sudo service nmbd restart

############Also getting from /var/log/samba log.billnbevs-pc#####################################

[2019/09/13 15:56:54.807565, 0] ../source3/smbd/service.c:782(make_connection_snum)
make_connection_snum: canonicalize_connect_path failed for service CCTV_In, path /home/pi/CCTV_In ## added for 4TB HDD
[2019/09/13 15:56:54.808888, 0] ../source3/smbd/service.c:782(make_connection_snum)
make_connection_snum: canonicalize_connect_path failed for service CCTV_In, path /home/pi/CCTV_In ## added for 4TB HDD

##Yet when I enter cd /home/pi/CCTV_In it takes me straight to that directory
##################################################################

So I added the missing instructions in /var/log/samba log.nmbd.

Now I'm chasing up on the fault in /var/log/samba log.billnbevs-pc

Re: ARRRRGGGHHHH Its happened again! - Lost Samba settings

Posted: Sun Sep 15, 2019 9:20 am
by doubleudee1
That first parameter I added (perferred master = yes) seemed to be ignored when I queried the system with 'smbclient -L localhost -N'

here's my smb.conf now:-

Code: Select all

 testparm
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[printers]"
Processing section "[CCTV_In]"
Processing section "[print$]"
Loaded services file OK.
Server role: ROLE_STANDALONE

Press enter to see a dump of your service definitions

# Global parameters
[global]
        log file = /var/log/samba/log.%m
        logging = file
        map to guest = Bad User
        max log size = 1000
        obey pam restrictions = Yes
        pam password change = Yes
        panic action = /usr/share/samba/panic-action %d
        passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
        passwd program = /usr/bin/passwd %u
        server role = standalone server
        unix password sync = Yes
        usershare allow guests = Yes
        wins support = Yes
        idmap config * : backend = tdb
        create mask = 0775
        directory mask = 0775
        read only = No
        valid users = %S


[printers]
        browseable = No
        comment = All Printers
        create mask = 0700
        path = /var/spool/samba
        printable = Yes
        read only = Yes


[CCTV_In]
        comment = Incoming File From CCTV Camerass
        create mask = 0777
        directory mask = 0777
        guest ok = Yes
        path = /home/pi/CCTV_In ## added for 4TB HDD


[print$]
        comment = Printer Drivers
        path = /var/lib/samba/printers
        read only = Yes

#########################################################################

Re: ARRRRGGGHHHH Its happened again! - Lost Samba settings

Posted: Sun Sep 15, 2019 10:05 am
by doubleudee1
Now getting:-

smbclient -L localhost -N

Unable to initialize messaging context
Anonymous login successful
tree connect failed: NT_STATUS_ACCESS_DENIED

???????????

Re: ARRRRGGGHHHH Its happened again! - Lost Samba settings

Posted: Sun Sep 15, 2019 10:46 am
by DougieLawson
Have you got a firewall running?

If it's ufw you need to allow samba through the firewall. If I assume your RPi is 192.168.3.14 in a 192.168.3.0/24 subnet.

Sledgehammer approach:
sudo ufw allow to any from 192.168.3.0/24
sudo ufw allow from any to 192.168.3.0/24


or subtle approach:
sudo ufw allow from 192.168.3.0/24 to any app Samba
sudo ufw allow to 192.168.3.0/24 from any app samba

Re: ARRRRGGGHHHH Its happened again! - Lost Samba settings

Posted: Sun Sep 15, 2019 12:37 pm
by doubleudee1
I have a firewal running, it comes with my BT Router and it's McCafee, my pi is 192.168.1.227, I tried the command you gave me and this came back:-

Code: Select all

sudo ufw allow to any from 192.168.1.0/24
sudo: ufw: command not found
?

Re: ARRRRGGGHHHH Its happened again! - Lost Samba settings

Posted: Sun Sep 15, 2019 12:48 pm
by doubleudee1
and if I try to connect from windows through 'Map Network Drive' I get:-
Image

Re: ARRRRGGGHHHH Its happened again! - Lost Samba settings

Posted: Sun Sep 15, 2019 12:50 pm
by DougieLawson
Have you created a samba user with sudo smbpasswd -a pi?