顯示具有 raspberry 標籤的文章。 顯示所有文章
顯示具有 raspberry 標籤的文章。 顯示所有文章

2016年1月28日 星期四

ubuntu samba user home directors

Ref.http://linux.vbird.org/linux_server/0370samba.php

sudo apt-get install samba
sudo apt-get install python-glade2 system-config-samba

sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
vim /etc/samba/smb.conf
 

更改以下項目
#======================= Share Definitions =======================

# Un-comment the following (and tweak the other settings below to suit)
# to enable the default home directory shares. This will share each
# user's home directory as \\server\username
[homes]
   comment = Home Directories
   browseable = yes

# By default, the home directories are exported read-only. Change the
# next parameter to 'no' if you want to be able to write to them.
   read only = no

# File creation mask is set to 0700 for security reasons. If you want to
# create files with group=rw permissions, set next parameter to 0775.
   create mask = 0775

# Directory creation mask is set to 0700 for security reasons. If you want to
# create dirs. with group=rw permissions, set next parameter to 0775.
directory mask = 0775

# By default, \\server\username shares can be connected to by anyone
# with access to the samba server.
# Un-comment the following parameter to make sure that only "username"
# can connect to \\server\username
# This might need tweaking when using external authentication schemes
   valid users = %S


創造samba 帳戶和密碼
#smbpasswd -a "username"

enable user
#smbpasswd -e username


重啟
#service smbd restart

使用windows 登入

連接網路磁碟機
\\server\username



=> 避免掛載新磁碟機到各user底下後無法access

sudo vi /etc/samba/smb.conf 在 [global] tag中加入

follow symlinks = yes 

unix extensions = no 

wide links = yes

2016年1月25日 星期一

raspberry ubuntu mate 15.10

##先前準備
SDFormatter
Win32DiskImager

##安裝下載 (請安裝英文版)
https://ubuntu-mate.org/raspberry-pi/


Re-size file system
sudo fdisk /dev/mmcblk0

Delete the second partition (d, 2), then re-create it using the defaults (n, p, 2, enter, enter), then write and exit (w). Reboot the system, then:sudo resize2fs /dev/mmcblk0p2

查看硬碟狀況
df -h

##設定WIFI 且開機自動連線
修改 vim /etc/network/interfacesauto wlan0
allow-hotplup wlan0
iface wlan0 inet static
        address 192.168.0.102
        netmask 255.255.255.0
        gateway 192.168.0.1
        wpa-ssid "SSID"
        wpa-psk "PASSWD"
dns-nameservers 168.95.192.1 8.8.8.8

or
iface wlan0 inet dhcp

ref.http://gsyan888.blogspot.tw/2013/04/raspberry-pi-wireless-network.html

##更新軟體
apt-get update
apt-get upgrade


##關閉圖形介面
graphical enable/disable

console開啟圖形介面
startx

##root遠端登入
1. 修改 /etc/ssh/sshd_config
# vim /etc/ssh/sshd_config
把 PermitRootLogin without-password 前面加上 # 註解
#PermitRootLogin without-password
加入下面這一行
PermitRootLogin yes
2. 重新啟動電腦或重新啟動 ssh Server
# sync;sync;sync;sync;reboot

##安裝必要軟體
*編輯器
apt-get install vim

*多功軟體
apt-get install tmux

*windows to linux 遠端桌面
apt-get install xrdp



##定期動備份至NAS (way1)
在此使用方式為掛載網路硬碟NAS,再使用resync 同步

*掛載 ref.
mkdir /mnt/mountDirector
mount -t cifs //{ip address}/{share} -o username={username},password={password} /mnt/mountDirector/
/mnt/mountDirector/ 為 mount point,取消用 umount /mnt/mountDirector/
編碼可加上iocharset=utf8這種寫法

*RSYNC 備份軟體 (src改為 / (root director)在此的Dest改為/mnt/mountDirector/)
WiKi
rsync -av /src/foo /dest 會在 /dest 下產生一個 foo 的資料夾,表示複製這個資料夾。
rsync -av /src/foo/ /dest 則不會在 /dest 下產生一個 foo 的資料夾,表示複製這個資料夾下

*定期備份

#vim cronfiles/rsync.sh
rsync -av / /mnt/synology_215j/raspberry_ubuntu/

plz try:
rsync -av /* /path/to/backup/folder --exclude={/dev/*,/proc/*,/sys/*,/tmp/*,/run/*,/mnt/*,/media/*,/lost+found}

#vim /etc/crontabm


##定期動備份至NAS (way2)
後來覺得way1 不好用,rsync 常常會跳出error  權限不足之累的,改用ssh 就好一點只要先設好key 的話是頗方便的,請參考
http://programingman.blogspot.tw/2016/05/linux-server.html



最後加進cronfile

  *   *   *   *   *  root /bin/sh /cronfiles/rsync.sh
(分 時 日月 周) (執行者)   (執行shell)   (script)


*收割
#/etc/init.d/cron restart