Size: 408
Comment:
|
Size: 2622
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 2: | Line 2: |
== Samba3 by example == * https://www.samba.org/ Samba is the standard Windows interoperability suite of programs for Linux and Unix. * https://www.samba.org/samba/docs/Samba3-ByExample.pdf * https://www.samba.org/samba/docs/using_samba/toc.html * https://www.samba.org/samba/docs/old/Samba3-ByExample/ |
|
Line 5: | Line 13: |
Line 6: | Line 15: |
mount -t cifs -o userx,passwordx //<servername>/<sharename> /mnt/point/ | yum install cifs-utils mount -t cifs -o username=userx,password=passwordx //<servername>/<sharename> /mnt/point/ |
Line 13: | Line 23: |
== Backup all files == File backup.sh: {{{#!highlight bash #!/bin/bash logfile=/mnt/point/backups`date '+%F'`.log datex=`date '+%FT%T'` hostx=`hostname` backfile=/mnt/point/"$hostx"_backup.tar.gz echo "$datex $hostx Log file: $logfile" >> $logfile echo "$datex $hostx Executing backup on /mnt/point" >> $logfile cd / rm $backfile echo "$datex $hostx Removed $backfile" >> $logfile tar cpzf $backfile --exclude=/proc --exclude=/dev --exclude=/media --exclude=/mnt --exclude=/lost+found / >> $logfile datex=`date '+%FT%T'` echo "$datex $hostx Ended backup on /mnt/point" >> $logfile }}} Add a crontab entry like '''@daily /home/userx/backup.sh'''. == smbclient Copy files recursively to share == {{{#!highlight sh smbclient -U userx //192.168.1.1/c$ -c 'cd folderx;recurse;prompt;mput *' }}} == Raspbian samba share == {{{#!highlight sh sudo apt install samba netstat -at -n | grep 139 sudo service --status-all sudo service smbd restart sudo apt install smbclient cifs-utils smbclient --list xyz.bitarus.mooo.com --no-pass cd /etc/samba sudo cp smb.conf smb.conf.orig smbclient //xyz.bitarus.mooo.com/shared --no-pass }}} === /etc/samba/smb.conf === {{{#!highlight sh [global] workgroup = wgroup dns proxy = no 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 usershare allow guests = yes [shared] path = /tmp/shared read only = no guest ok = yes }}} |
Samba share
Samba3 by example
Samba is the standard Windows interoperability suite of programs for Linux and Unix.
Mount samba share on CentOS 6.3
Adapted from http://www.centos.org/docs/5/html/Deployment_Guide-en-US/s1-samba-connect-share.html
Add entry to /etc/fstab:
1 //<servername>/<sharename> /mnt/point/ cifs username=userx,password=passwordx,_netdev 0 0
Backup all files
File backup.sh:
1 #!/bin/bash
2 logfile=/mnt/point/backups`date '+%F'`.log
3 datex=`date '+%FT%T'`
4 hostx=`hostname`
5 backfile=/mnt/point/"$hostx"_backup.tar.gz
6
7 echo "$datex $hostx Log file: $logfile" >> $logfile
8 echo "$datex $hostx Executing backup on /mnt/point" >> $logfile
9 cd /
10 rm $backfile
11 echo "$datex $hostx Removed $backfile" >> $logfile
12 tar cpzf $backfile --exclude=/proc --exclude=/dev --exclude=/media --exclude=/mnt --exclude=/lost+found / >> $logfile
13 datex=`date '+%FT%T'`
14 echo "$datex $hostx Ended backup on /mnt/point" >> $logfile
Add a crontab entry like @daily /home/userx/backup.sh.
smbclient Copy files recursively to share
1 smbclient -U userx //192.168.1.1/c$ -c 'cd folderx;recurse;prompt;mput *'
Raspbian samba share
/etc/samba/smb.conf
1 [global]
2 workgroup = wgroup
3 dns proxy = no
4 log file = /var/log/samba/log.%m
5 max log size = 1000
6 # syslog = 0
7 panic action = /usr/share/samba/panic-action %d
8 server role = standalone server
9 passdb backend = tdbsam
10 obey pam restrictions = yes
11 unix password sync = yes
12 passwd program = /usr/bin/passwd %u
13 passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
14 pam password change = yes
15 map to guest = bad user
16 usershare allow guests = yes
17
18 [shared]
19 path = /tmp/shared
20 read only = no
21 guest ok = yes