Welcome! Log In Create A New Profile

Advanced

HOWTO : SAMBA / CIFS

Posted by Gravelrash 
HOWTO : SAMBA / CIFS
June 10, 2016 03:20AM
We will be configuring this with as an open share that everybody in the network will have read/write privilege


Install SAMBA Server and Client

apt-get update; apt-get upgrade -f -y; apt-get install samba cifs-utils --install-recommends -f -y;
Now its time to flush the disk(s) and reboot
sync; reboot

I will be making the following assumptions (just amend to suit your environment)

1. You already have a working system!
2. Your media to be shared is mounted via fstab by its label, in this case Disk1
3. The mounted disk resides in the following folder /media/Disk1
4. this mount has a folder inside called /Data

Configure Samba Server (as root)
mv /etc/samba/smb.conf /etc/samba/smb.conf.old
create a new smb.conf with teh following commands:
touch /etc/samba/smb.conf
nano /etc/samba/smb.conf
copy and past the following into the edited file
[global]
	server string = %h server
	map to guest = Bad User
	obey pam restrictions = Yes
	pam password change = Yes
	passwd program = /usr/bin/passwd %u
	passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
	unix password sync = Yes
	syslog = 0
#	log file = /var/log/samba/log.%m
	max log size = 1000
	client signing = required
	dns proxy = No
	usershare allow guests = Yes
	panic action = /usr/share/samba/panic-action %d
	idmap config * : backend = tdb
        socket options = SO_KEEPALIVE TCP_NODELAY IPTOS_LOWDELAY SO_SNDBUF=131072 SO_RCVBUF=131072
        create mode = 777
        directory mode = 777
	interfaces = eth0
# 	bind interface only = yes

[DATA]
        delete readonly = yes
        writeable = yes
        browseable = yes
        public = yes
	guest ok  = Yes
	path = /media/Disk1/Data
Test the Samba conf file for any syntax error:
cd /etc/samba
testparm
If there is any error then it will tell you and show some indication where to look to fix.
if there are no errors you will see "normal" output of the test.

Restart Samba
service samba restart
Correct the permissions on the folder so anyone can read and write. To allow anonymous user access give the permissions as follows;
cd /media/Disk1
chmod -R 0755 Data/
chown -R nobody:nogroup Data/

Now anonymous users can browse & create file and folder contents.



Edited 14 time(s). Last edit at 06/25/2016 07:18AM by Gravelrash.
Re: HOWTO: SAMBA / CIFS
June 10, 2016 03:21AM
Reserved
Re: HOWTO: SAMBA / CIFS
June 10, 2016 03:21AM
Please post questions / comments / feedback here
Re: HOWTO : SAMBA / CIFS
June 12, 2016 05:42PM
Gravelrash,

>
> apt-get update; apt-get upgrade -f -y; apt-get
> install samba cifs-utils --install-recommends -f
> -y; sync; reboot;
>

I think this should be broken into 2 commands. If there is a break before the last 2 commands, if encoutered with errors in the 1st part then users will have a chance to gather more information and capture to a log file.
sync; reboot;

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: HOWTO : SAMBA / CIFS
June 12, 2016 06:12PM
bodhi Wrote:
-------------------------------------------------------
> encoutered with errors in the 1st part then users
> will have a chance to gather more information and
> capture to a log file.

@bodhi
Done!
Re: HOWTO : SAMBA / CIFS
June 24, 2016 11:26AM
Gravelrash Wrote:
-------------------------------------------------------
> bodhi Wrote:
> --------------------------------------------------
> -----
> > encoutered with errors in the 1st part then
> users
> > will have a chance to gather more information
> and
> > capture to a log file.
>
> @bodhi
> Done!

Samba install is not a problem. What I have an issue with, and that I've spent two, three days on is this:
automounting SAMBA shares using cifs

Here's my textbook fstab line that is not working:
//servername/sharename /media/windowsshare cifs credentials=/home/ubuntuusername/.smbcredentials,iocharset=utf8,sec=ntlm 0 0

And my latest error:
error 2 (No such file or directory) opening credential file /home/ubuntuusername/.smbcredentials

Since I created the .smbcredentials with root, I've replaced ubuntuusername with root. No cigar.
I'm testing on Ubuntu Wily and you name it, all that's needed, I've installed.
The server is on another box and has SAMBA server installed on it. And, yes, the server works well.
I can browse and connect to the shares on it.
But I want to automount, as would be good for the pogo
I'm about to give up, and install autofs on the pinkpogo, but thought, well drop this on the lap of the learned ones.
So! since the title on this thread mentions CIFS, well, I thought I'd be a bother. Anyone out there automounting SAMBA shares using CIFS?

If no answer, perhaps you say how you automount your SAMBA shares. At this point, I could care less what's out there, just what's working will do fine.
Re: HOWTO : SAMBA / CIFS
June 24, 2016 12:17PM
what you are looking for is what i actually do on my own Mint Laptop.

If i understand you correctly you are looking to mount the remote server share to your local workstation at boot time using /etc/fstab

please correct me if i am wrong.

what errors if any show up in your dmesg outptus?

do you have the correct codepage installed on your machine?

does the folder you are looking to mount into exist at teh path you specified?

try this :

edit you /etc/fstab and add the following

sudo nano /etc/fstab

modify your share / I.P. address / mount path to match your network
# Samba/CIFS mount

//192.168.10.254/DATA  /home/gravelrash/DATA  cifs  guest,uid=1000,iocharset=utf8  0  0

force fstab to "reload"
sudo mount -a

Let me know the outcome



Edited 5 time(s). Last edit at 06/24/2016 02:39PM by Gravelrash.
Re: HOWTO : SAMBA / CIFS
June 24, 2016 06:21PM
Gravelrash Wrote:
-------------------------------------------------------
> what you are looking for is what i actually do on
> my own Mint Laptop.
>
> If i understand you correctly you are looking to
> mount the remote server share to your local
> workstation at boot time using /etc/fstab
>
> please correct me if i am wrong.

You're quite correct. Only now I'm not using my pogo, testing instead on my laptop first. It's simply convenient for me.
>
> what errors if any show up in your dmesg outptus?

CIFS VFS: cifs_mount failed w/return code = -6

> do you have the correct codepage installed on your
> machine?
>
> does the folder you are looking to mount into
> exist at teh path you specified?

Yes, I created a new one as well, focusing to ensure that I'm not doing so as "root" Because one of the many errors I've had, when mounting via Thunar: "mount: only root can mount //192.x.x.x.x.x...."
>
> try this :
>
> edit you /etc/fstab and add the following
>
>
> sudo nano /etc/fstab
>
>
> modify your share / I.P. address / mount path to
> match your network
>
> # Samba/CIFS mount
> 
> //192.168.10.254/DATA  /home/gravelrash/DATA  cifs
>  guest,uid=1000,iocharset=utf8  0  0
>
>
> force fstab to "reload"
>
> sudo mount -a
>
>
> Let me know the outcome

Aside what is above, in terminal, I get:
"mount.nfs: Connection timed out
Retrying with upper case share name
mount error(6): No such device or address
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)"

I've done this, thinking without the password file, I'd be good to go. No cigar.
There has to be something. Can you share the details of your setup?
Many thanks.
Re: HOWTO : SAMBA / CIFS
June 25, 2016 07:16AM
Very happy to share my setup.

The software installation on server is done as per the instructions above. below is my SERVER smb.conf
[global]
	server string = %h server
	map to guest = Bad User
	obey pam restrictions = Yes
	pam password change = Yes
	passwd program = /usr/bin/passwd %u
	passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
	unix password sync = Yes
	syslog = 0
#	log file = /var/log/samba/log.%m
	max log size = 1000
	client signing = required
	dns proxy = No
	usershare allow guests = Yes
	panic action = /usr/share/samba/panic-action %d
	idmap config * : backend = tdb

# MY MODS
        socket options = SO_KEEPALIVE TCP_NODELAY IPTOS_LOWDELAY SO_SNDBUF=131072 SO_RCVBUF=131072
        create mode = 777
        directory mode = 777
	interfaces = eth0

[DATA]
        delete readonly = Yes
        writeable = Yes
        public = Yes
	guest ok = Yes
	path = /mnt/SATA/DATA
	browseable = Yes

server /etc/fstab (standard mounts removed)
# Self Mounted

# Standard HDD
LABEL=DATA      /mnt/SATA       ext4    suid,errors=continue,dev,noatime,exec   0       2

# Additional USB disk
# LABEL=1TB     /mnt/usb        ext4    errors=continue,dev,noatime     0       2

# Swapdisk
/dev/sda1       swap    swap    defaults        0       0

The software installation on Client is done as per the instructions above for SERVER. below is my Client smb.conf
# Global parameters
[global]
	server string = %h server (Samba, Linux Mint)
	server role = standalone server
	map to guest = Bad User
	obey pam restrictions = Yes
	pam password change = Yes
	passwd program = /usr/bin/passwd %u
	passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
	unix password sync = Yes
	syslog = 0
	log file = /var/log/samba/log.%m
	max log size = 1000
	name resolve order = bcast host
	dns proxy = No
	usershare allow guests = Yes
	panic action = /usr/share/samba/panic-action %d
	idmap config * : backend = tdb


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


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

/etc/fstab with standard mounts removed for clarity
# Self Mounted
# remote Data share
//192.168.2.200/DATA  /home/gravelrash/DATA  cifs  guest,uid=1000,iocharset=utf8  0  0

Re: HOWTO : SAMBA / CIFS
June 25, 2016 01:58PM
Gravelrash Wrote:
-------------------------------------------------------
> Very happy to share my setup.
>
> The software installation on server is done as per
> the instructions above. below is my SERVER
> smb.conf
>
> [global]
> 	server string = %h server
> 	map to guest = Bad User
> 	obey pam restrictions = Yes
> 	pam password change = Yes
> 	passwd program = /usr/bin/passwd %u
> 	passwd chat = *Enter\snew\s*\spassword:* %n\n
> *Retype\snew\s*\spassword:* %n\n
> *password\supdated\ssuccessfully* .
> 	unix password sync = Yes
> 	syslog = 0
> #	log file = /var/log/samba/log.%m
> 	max log size = 1000
> 	client signing = required
> 	dns proxy = No
> 	usershare allow guests = Yes
> 	panic action = /usr/share/samba/panic-action %d
> 	idmap config * : backend = tdb
> 
> # MY MODS
>         socket options = SO_KEEPALIVE TCP_NODELAY
> IPTOS_LOWDELAY SO_SNDBUF=131072 SO_RCVBUF=131072
>         create mode = 777
>         directory mode = 777
> 	interfaces = eth0
> 
> [DATA]
>         delete readonly = Yes
>         writeable = Yes
>         public = Yes
> 	guest ok = Yes
> 	path = /mnt/SATA/DATA
> 	browseable = Yes
>
>
> server /etc/fstab (standard mounts removed)
>
> # Self Mounted
> 
> # Standard HDD
> LABEL=DATA      /mnt/SATA       ext4   
> suid,errors=continue,dev,noatime,exec   0       2
> 
> # Additional USB disk
> # LABEL=1TB     /mnt/usb        ext4   
> errors=continue,dev,noatime     0       2
> 
> # Swapdisk
> /dev/sda1       swap    swap    defaults        0 
>      0
>
>
> The software installation on Client is done as per
> the instructions above for SERVER. below is my
> Client smb.conf
>
> # Global parameters
> [global]
> 	server string = %h server (Samba, Linux Mint)
> 	server role = standalone server
> 	map to guest = Bad User
> 	obey pam restrictions = Yes
> 	pam password change = Yes
> 	passwd program = /usr/bin/passwd %u
> 	passwd chat = *Enter\snew\s*\spassword:* %n\n
> *Retype\snew\s*\spassword:* %n\n
> *password\supdated\ssuccessfully* .
> 	unix password sync = Yes
> 	syslog = 0
> 	log file = /var/log/samba/log.%m
> 	max log size = 1000
> 	name resolve order = bcast
> host
> 	dns proxy = No
> 	usershare allow guests = Yes
> 	panic action = /usr/share/samba/panic-action %d
> 	idmap config * : backend = tdb
> 
> 
> [printers]
> 	comment = All Printers
> 	path = /var/spool/samba
> 	create mask = 0700
> 	printable = Yes
> 	browseable = No
> 
> 
> [print$]
> 	comment = Printer Drivers
> 	path = /var/lib/samba/printers
> 
>
>
> /etc/fstab with standard mounts removed for
> clarity
>
> # Self Mounted
> # remote Data share
> //192.168.2.200/DATA  /home/gravelrash/DATA  cifs 
> guest,uid=1000,iocharset=utf8  0  0
> 
>

Thanks a lot. This looks good and it's obviously working. Except for the server side, I have much of what you have here. My SAMBA config is different from yours, but that can't be the problem. I'm willing to be proven wrong.

Anyone here with experience setting up autofs? I think I'm done with this for now. I'm beginning to suspect it's my version of Ubuntu. But then again, the pogo won't mount the SAMBA share either.

Thanks a lot. If I work more on it and get results, I will create a thread, if others think it necessary.
Re: HOWTO : SAMBA / CIFS
June 25, 2016 04:05PM
might be better if you share your /etc/fstab and /etc/samba/smb.conf so we can examine and see where the issue lies
Re: HOWTO : SAMBA / CIFS
June 26, 2016 03:33AM
notoneofmyseeds,

> Anyone here with experience setting up autofs? I
> think I'm done with this for now. I'm beginning to
> suspect it's my version of Ubuntu. But then again,
> the pogo won't mount the SAMBA share either.

Go ahead and google autofs, or start here. This Ubuntu tutorial is basically the same as used on any Debian distro:
https://help.ubuntu.com/community/Autofs

When you are setting it up, any problem or questions then post them. I'm not near my plugs so I can not post a good tutorial for autofs.

-bodhi
===========================
Forum Wiki
bodhi's corner



Edited 1 time(s). Last edit at 06/26/2016 03:35AM by bodhi.
Re: HOWTO : SAMBA / CIFS
June 26, 2016 02:57PM
bodhi Wrote:
-------------------------------------------------------
> notoneofmyseeds,
>
> > Anyone here with experience setting up autofs?
> I
> > think I'm done with this for now. I'm beginning
> to
> > suspect it's my version of Ubuntu. But then
> again,
> > the pogo won't mount the SAMBA share either.
>
> Go ahead and google autofs, or start here. This
> Ubuntu tutorial is basically the same as used on
> any Debian distro:
> https://help.ubuntu.com/community/Autofs
>
> When you are setting it up, any problem or
> questions then post them. I'm not near my plugs so
> I can not post a good tutorial for autofs.

Thanks bohdi for that link. I've seen and read it.

OK, I will take a dip and may emerge with a HowTo.

See you soon...in the forum.
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: