2013年4月13日 星期六

samba4.0分享設定中的share已經不行用了

samba4.0已經不能設定security = share了,如果一樣要用匿名分享,只要修改以下幾行就行了。



sudo vim /etc/samba/smb.conf


[global]

security = user

map to guest = Bad User

guest ok = Yes

guest account = XXX


最後一個guest account不一定要設功能是以匿名登入後使其認為是你所指定的ID連入,只要本機的資料是你那個所指定的ID所建立的,都可以直接刪除,不用設定writable = yes囉。之前幾版好像就有對我來講還蠻好用的所以補上它。



設定完成要重開smbd nmbd才會生效哦



sudo systemctl restart smbd nmbd


以下是我的完整設定可以參考參考。有需要看自已的請用指令:

testparm


Load smb config files from /etc/samba/smb.conf

rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)

Processing section "[homes]"

Processing section "[printers]"

Processing section "[電影]"

Processing section "[連續劇]"

Processing section "[歌仔戲]"

Processing section "[tmp]"

Loaded services file OK.

Server role: ROLE_STANDALONE

Press enter to see a dump of your service definitions





[global]

workgroup = MSHOME

server string = Samba Server

map to guest = Bad User

guest account = hepha

log file = /var/log/samba/log.%m

max log size = 50

printcap name = /etc/printcap

dns proxy = No

wins support = Yes

idmap config * : backend = tdb

guest ok = Yes



[homes]

comment = Home Directories

read only = No

browseable = No



[printers]

comment = All Printers

path = /var/spool/samba

guest ok = No

printable = Yes

print ok = Yes

browseable = No



[電影]

path = /mnt/big

read only = No

create mask = 0664

directory mask = 0775

想要了解更多4.0版的請看另外4.0版也可以當不過我用不到沒研究。



另外我在Jamyy's的部落格看到以下兩個設定或許對其它也有用。

Fedora 9 升級 Samba Server

徹底取消印表機功能



load printers = no

printcap name = /dev/null

disable spoolss = yes

;cups options = raw



samba 3.5 以上, 允許家目錄內的 soft link



wide links = yes

unix extensions = no


參考資料:

2012年11月21日 星期三

install arch64 for hard driver

以前弄ubuntu的似乎是比較簡單,arch設定有點不同,今天終於弄成功了,很棒!



  • 另外得知pacstrap、genfstab、arch-chroot,只要安裝arch-install-scripts就能執行了,這樣應該能在原有系統進行安裝囉。







我們要先取得存放裝置的_id與iso檔案的archisolabel



  • _id

sudo blkid|grep total
/dev/sdb2: LABEL="total" UUID="b7d0b427-8963-4e09-a5cd-93d703b9ff9f" TYPE="ext4"


  • archisolabel

iso-info /mnt/total/iso/arch/archlinux-2012.11.01-dual.iso
iso-info version 0.83 x86_64-unknown-linux-gnu

ISO 9660 image: /mnt/total/iso/arch/archlinux-2012.11.01-dual.iso

Application: ARCH LINUX LIVE/RESCUE CD

Preparer : PREPARED BY MKARCHISO

Publisher : ARCH LINUX

Volume : ARCH_201211


完成後新建一個檔案,內容請自行修改。

sudo vim /etc/grub.d/60_Arch


#!/bin/bash
exec tail -n +3 $0
menuentry "Archlinux-2012.11.01 uuid" {
_id=b7d0b427-8963-4e09-a5cd-93d703b9ff9f
insmod loopback
insmod iso9660
search --fs-uuid --no-floppy --set=root $_id
set isofile="/iso/arch/archlinux-2012.11.01-dual.iso"
loopback loop $isofile
linux (loop)/arch/boot/x86_64/vmlinuz archisolabel=ARCH_201211 img_dev=/dev/disk/by-uuid/$_id img_loop=$isofile
initrd (loop)/arch/boot/x86_64/archiso.img
}


再來就是寫入grub.cfg,最後重新開機測試囉

sudo chmod +x /etc/grub.d/60_Arch
sudo grub-mkconfig -o /boot/grub/grub.cfg


附上Installation Guide (正體中文)



參考資料: GRUB2 (正體中文)

2012年11月7日 星期三

Install Nvidia Beta Driver On Arch Linux

我沒有實際在Linux試過遊戲效能,只是看到新東西就想裝一下,加上安裝出現下面那個錯誤就順便記錄一下怎麼處理。



NVIDIA 推出全新 GeForce R310 驅動程式 大幅提升 Linux 平台遊戲效能

Valve 公司行銷副總裁 Doug Lombardi 表示:「 NVIDIA (輝達) 今天釋出的驅動程式,可讓遊戲在 Linux 平台上全面提升效能。 NVIDIA (輝達) 在遊戲界的領導地位毋庸置疑,並率先與我們和其他遊戲開發商一起開發了 R310 驅動程式,這是遊戲玩家在 Linux 玩遊戲的一大福音,這無疑是一個讓 Linux 遊戲快速大幅提升效能的好方法。」


NVIDIA R310驅動性能翻番-Steam,Linux,NVIDIA,R310,310.14-驅動之家

所謂的遊戲性能翻番,NVIDIA是這麼解釋的:在基於Core i7-3930K 3.2GHz處理器、8GB內存、GeForce GTX 680顯卡、Ubuntu 12.04 32位系統的平台上,《Left 4 Dead 2》遊戲使用304.51驅動的幀率為142.7FPS,換成310.14則可以跑出301.4FPS,提升了1.1倍。
根據NVIDIA的說法,310.14驅動適合使用GeForce GTX 600系列最新顯卡的Linux玩家,GeForce 8800 GT以上的也可以更新但效果沒那麼明顯。






nvidia-beta-all適用於liunx、linux-ck(我有裝這兩個核心),linux-uksm、linux-uksm-ck或許可用(目前沒裝沒試)。



For hava yaourt

yaourt -S nvidia-beta-all


For no have yaourt

先安裝nvidia-utils-beta後安裝nvidia-beta-all



Error message

如果安裝過程出現以下訊息停止安裝,請安裝linux-headers在重新安裝驅動程式即可。

If you are using a Linux 2.4 kernel, please make sure you either have configured kernel sources matching your kernel or the correct set of kernel headers installed on your system.



If you are using a Linux 2.6 kernel, please make sure you have configured kernel sources matching your kernel installed on your system. If you specified a separate output directory using either the “KBUILD_OUTPUT” or the “O” KBUILD parameter, make sure to specify this directory with the SYSOUT environment variable or with the equivalent nvidia-installer mmand line option.



Depending on where and how the kernel sources (or the kernel headers) were installed, you may need to specify their location with the SYSSRC environment variable or the equivalent nvidia-installer command line option.


初次安裝官方驅動程式請執行此指令產生新的xorg.conf設定檔



sudo nvidia-xconfig




參考資料:NVIDIA - ArchWiki

2012年11月6日 星期二

Fix【新版】定時調整音量

這裡是定時調整音量新版,說明請看舊版,這次新加入在晚上自動將音量調小前儲存原本音量,過了設定的週期或重新開機時設回原本音量。





Fix Note:


  1. 取得音量錯誤,無法正確儲存音量。

  2. 比對時間錯誤。


Add Note:


  • 睡眠週期設定:

    _SleepOn=音量調整的開始時間 

    _SleepOff=音量調整的結束時間 

    _SleepVolume=調整音量為此設定值 





Default Useing:



當22點(晚上10點)先儲存你目前音量,而後從22點(晚上10點)至9點(早上9點)音量調整為85%,於10點後(含)恢復先前所儲存的音量設定。



P.S 設定1點到9點前面不用加0,也就是3點就寫成3不要寫成03,這樣無法比對時間。



#!/bin/bash
_Hour=$(date "+%-H")
_Sound=/var/tmp/sound
_SleepOn=22
_SleepOff=9
_SleepVolume=85%
_SAVE(){
_Mono=$(amixer get Master | grep "Mono:" | awk '{print $4}' | tr -d '[]')
_Front=$(amixer get Master | grep "Front Left:" | awk '{print $5}' | tr -d '[]')
if [ "x${_Front}" != "x" ]
then
_Volume=${_Front}
elif [ "x${_Mono}" != "x" ]
then
_Volume=${_Mono}
else
echo "Unknown Volume"
exit
fi
echo "_Default=${_Volume}" >> ${_Sound}
echo "Save Volume: ${_Volume}"
}

echo "The time now: ${_Hour} "
if [[ -f ${_Sound} && ${_Hour} -le ${_SleepOff} || ${_Hour} -ge ${_SleepOn} ]]
then
echo "Now is Sleep Time Change Volume: ${_SleepVolume}"
amixer sset Master ${_SleepVolume} 1>/dev/null
elif [[ ${_Hour} -le ${_SleepOff} || ${_Hour} -ge ${_SleepOn} ]]
then
_SAVE
echo "Now is Sleep Time Change Volume: ${_SleepVolume}"
amixer sset Master ${_SleepVolume} 1>/dev/null
elif [[ -f ${_Sound} && ${_Hour} -gt ${_SleepOff} && ${_Hour} -lt ${_SleepOn} ]]
then
. ${_Sound}
echo "Now the end of the sleep time to restore the volume: ${_Default}"
amixer sset Master ${_Default} 1>/dev/null
rm -f ${_Sound}
fi



2012年10月12日 星期五

Firefox無法在Google Translate發出聲音?

不知何時開始我的Firefox無法在Google Translate發出聲音,找了很多文章修改設定都是沒用,使用Google Chrome就沒有這個問題,這是讓我苦惱的一件事。



今天心血來潮開Google Translate網頁的原始碼來看,發現了原來它是用Flash來播放聲音,那麼只要從Flash下手我想應該能解決。





Flash Player至使至終都裝著,那麼在從Flash相關套件下手,關閉Adblock Plus沒效那麼只剩一個影響的可能Flashblock



賓果,猜對了只要將Google Translate網頁加入Flashblock白名單,許久不見的聲音就出現了。





2012年9月28日 星期五

【新版】轉換mp3標籤使撥放軟體能正常顯示

比起之前寫的舊版多了兩個功能,其一:加入了trap按Ctrl+C時完全關閉程式,其二:加上了convmv一併轉換mp3檔案名稱成為utf-8。

#!/bin/bash
function conv_stop {
echo conv stop
}
if test ! -x /usr/bin/convmv ; then
echo will install convmv
exit
fi
if test ! -x /usr/bin/mid3iconv ; then
echo will install python-mutagen
exit
fi
trap "conv_stop;exit" SIGTERM SIGINT SIGHUP
IFS=""
find $1 -type f -iname \*.mp3 |
while read f ;do echo "處理中………"$f""
mid3iconv -e big5 --remove-v1 "$f" &>/dev/null
mid3iconv -e gbk --remove-v1 "$f" &>/dev/null
convmv -r -f big5 -t utf8 --notest "$f" &>/dev/null
convmv -r -f gbk -t utf8 --notest "$f" &>/dev/null
done
conv_stop


2012年9月26日 星期三

定時調整音量

通常家裡都我一個人,音樂放的都蠻大聲,但是到了夜晚家人要睡時我還醒著,聲音有時忘了調整小聲會影響到家人,所以,想了這個方法定時調整音量大小,到了晚上11點到早上9點之間自動降低音量,到了8點後自動調回來。



需要amixer沒有這個指令的請先安裝alsa-utils。



可以用這條指令取得目前音量



amixer |grep Master -A4|grep  Mono:
Mono: Playback 36 [92%] [-4.50dB] [on]



現在請播放音樂,然後用這個指令調整早上及晚上所需要的音量。



amixer sset Master ??%
其中??%音量最大為100%音量最小為0%



由於我希望每個小時都執行一次,所以,放在/etc/cron.hourly/裡面。



sudo gedit /etc/cron.hourly/sound-time


音量是由amixer所控制,這裡預設音量是85%,比對時間時間若是零晨到早上九點間,音量調整為70%。



add this code

#!/bin/bash
_date=$(date "+%H")
amixer sset Master 85%
if [[ ${_date} -le 9 || ${_date} -eq 23 ]] ; then
amixer sset Master 70%
fi


sudo chmod +x /etc/cron.hourly/sound-time




除了每小時檢查調整音量,我另外讓他在開機時檢查一次。



sudo gedit /etc/rc.local


add this code

/etc/cron.hourly/sound-time