วันพฤหัสบดีที่ 1 ธันวาคม พ.ศ. 2554

Ubuntu 10.04 Samba Standalone Server With tdbsam Backend


Ubuntu 10.04 Samba Standalone Server With tdbsam Backend


1 Preliminary Note

I'm using an Ubuntu 10.04 system here with the hostname server1.example.com and the IP address 192.168.0.100.
I'm running all the steps in this tutorial with root privileges, so make sure you're logged in as root:
sudo su

2 Installing Samba

Connect to your server on the shell and install the Samba packages:
aptitude install libcups2 samba samba-common
Edit the smb.conf file:
vi /etc/samba/smb.conf
In the global section, remove the "#" at the beginning of the line security = user so that it looks like this:
[...]
# "security = user" is always a good idea. This will require a Unix account
# in this server for every user accessing the server. See
# /usr/share/doc/samba-doc/htmldocs/Samba3-HOWTO/ServerType.html
# in the samba-doc package for details.
   security = user
[...]
This enables Linux system users to log in to the Samba server.
Close the file and restart Samba:
/etc/init.d/smbd restart

3 Adding Samba Shares

Now I will add a share that is accessible by all users.
Create the directory for sharing the files and change the group to the users group:
mkdir -p /home/shares/allusers
chown -R root:users /home/shares/allusers/
chmod -R ug+rwx,o+rx-w /home/shares/allusers/
At the end of the file /etc/samba/smb.conf add the following lines:
vi /etc/samba/smb.conf
[...]
[allusers]
  comment = All Users
  path = /home/shares/allusers
  valid users = @users
  force group = users
  create mask = 0660
  directory mask = 0771
  writable = yes
If you want all users to be able to read and write to their home directories via Samba, add the following lines to /etc/samba/smb.conf:
[...]
[homes]
   comment = Home Directories
   browseable = no
   valid users = %S
   writable = yes
   create mask = 0700
   directory mask = 0700
Now we restart Samba:
/etc/init.d/smbd restart

4 Adding And Managing Users

In this example, I will add a user named tom. You can add as many users as you need in the same way, just replace the username tom with the desired username in the commands.
useradd tom -m -G users
Set a password for tom in the Linux system user database. If the user tom should not be able to log in to the Linux system, skip this step.
passwd tom
-> Enter the password for the new user.
Now add the user to the Samba user database:
smbpasswd -a tom
-> Enter the password for the new user.
Now you should be able to log in from your Windows workstation with the file explorer (address is \\192.168.0.100 or \\192.168.0.100\tom for tom's home directory) using the username tom and the chosen password and store files on the Linux server either in tom's home directory or in the public shared directory.


ค่า config


[global]
   security = USER
## Browsing/Identification ###


# Change this to the workgroup/NT-domain name your Samba server will part of
   workgroup = WORKGROUP
   netbios name = datacenter
# server string is the equivalent of the NT Description field
   server string = %h server (Samba, Ubuntu)




admin users = jason

#   usershare allow guests = yes



[allusers]
  comment = All Users
  path = /home/shares/allusers
  valid users = @users
  force group = users
  create mask = 0660
  directory mask = 0771
  writable = yes

[homes]
   comment = Home Directories
   browseable = no
   valid users = %S
   writable = yes
   create mask = 0700
   directory mask = 0700





วันอังคารที่ 16 มีนาคม พ.ศ. 2553

วันจันทร์ที่ 1 กุมภาพันธ์ พ.ศ. 2553

โฟลเดอร์ ในไดร์ฟ D ถูกHidden

ใช้คำสั่ง Dos ก็ได้ครับ ง่ายดี
เข้า RUN พิมพ์ cmd กด Enter ก่อนนะครับ
จะเข้าโหมดของ Dos ใน วินโดว์ หน้าจอดำ ๆ นั่นแหละ
ยกเลิกการซ่อนทั้งหมดให้พิมพ์
attrib -s -h -r /S /D *.* แล้ว Enter จากนั้นกลับไปสังเกตดูในใดร์ฟ ว่า Folder กลับมาแล้วหรือไม่

ตัวอย่าง โฟลเดอร์ ในไดร์ฟ D ถูกHidden ไว้ ให้เข้าไปที่ D โดยพิมพ์ d: แล้ว Enter
เมื่อ เข้ามาอยู่ใน ไดร์ฟ D แล้ว ให้พิมพ์ attrib -s -h -r /S /D *.* ตาม แล้ว Enter
แล้ว Enter จากนั้นกลับไปสังเกตดูในใดร์ฟ ว่า Folder กลับมาแล้วหรือไม่

- ยกเลิกการซ่อนบาง Folder
attrib -s -h -r /S /D ชื่อโฟลเดอร์
(ไม่จำกัดว่า ชื่อโฟลเดอร์จะเป็นภาษาไทยหรือภาษาอังกฤษ
และชื่อโฟลเดอร์จะต้องไม่เว้นวรรค แต่ถ้ามีให้ทำการแก้ไขชื่อก่อน)

วันพุธที่ 23 ธันวาคม พ.ศ. 2552

วิธีการแก้ Password root ใน Linux กรณีอยู่หน้าเครื่อง

ในกรณี ที่ท่านใช้ GRUB
1. ให้ทำการ Reboot เครื่อง
2. ถ้าท่านตั้ง password ใน GRUB ให้กด p แล้วใส่ Password (ถ้าไม่ได้ตั้ง password ของ GRUB ไว้ให้ทำการข้ามขั้นตอนนี้)
3. ให้เลือก Linux version ที่ท่านต้องการ boot (ในกรณีที่ท่าน ได้ลง linux หลายค่าย หรือ หลาย version )
4. กด e ( เพื่อเข้าไปทำการแก้ไข )
5. ให้กด ลูกศร เพื่อเลื่อนไป บรรทัดที่ขึ้น ต้นคำว่า "kernel" แล้ว พิมพ์ e อีก เพื่อทำการแก้ไข เช่นkernal /vmlinuz-2.4.18.14 ro root=LABEL=/ hdc=ide-scsi
6. ให้เลื่อนไปท้าย สุด แล้ว กด Spacebar เพื่อเว้นวรรค แล้วพิมพ์ "single"จากนั้นให้ กด Enter เพื่อสิ้นสุดการแก้ไข ตัวอย่างkernal /vmlinuz-2.4.18.14 ro root=LABEL=/ hdc=ide-scsi single
7. พิมพ์ b เพื่อ boot แบบ single mode
8. เมื่อ อยู่ ใน single mode ท่านอยู่ในสถานะของ root สามารถ แก้ไข password โดยการใช้คำสั่ง "passwd"
9. ทำการ reboot โดยใช้คำสั่ง "reboot" หรือ "shutdown -r now"

Password root ใช้ GRUB เป็นบูตโหลดเดอร์ ที่ง่ายกว่า
1. ให้ทำการ Reboot เครื่อง
2. เมื่อเครื่องถึงหน้าจอบูตโหลดเดอร์ของ Grub แล้วให้กด ปุ่ม A
3. ให้ไปท้ายคำสั่ง กด Spacebar เพื่อเว้นวรรค แล้วพิมพ์ "single" ต่อท้าย แล้วกด Enter

การเปลี่ยน Password ในกรณีที่ท่านใช้ LILO
1. ให้ทำการ Reboot เครื่อง
2. ถ้าอยู่ในรูปแบบ LILO boot Prompt ให้พิมพ์ "linux single"แต่ถ้าอยู่ในรูปแบบ กราฟฟิค ให้ทำการกด Ctrl-x เพื่อออกจากรูปแบบกราฟฟิคก่อน แล้วพิมพ์ "linux single"
3. เมื่อ อยู่ ใน single mode ท่านอยู่ในสถานะของ root สามารถ แก้ไข password โดยการใช้คำสั่ง "passwd"
4. ทำการ reboot โดยใช้คำสั่ง "reboot" หรือ "shutdown -r now"


ที่มา : http://www.thaiadmin.org/board/index.php?topic=17737.msg89921#msg89921

วันจันทร์ที่ 26 มกราคม พ.ศ. 2552

การติดตั้ง NTP Server

#การติดตั้ง NTP Server (Time Server) ใน ubuntu
#การติดตั้ง NTP Server (Time Server) ใน ubuntuapt-get install ntp
# หรือaptitude install ntp
# config-file จะอยู่ที่ directory /etc/ntp.confvi /etc/ntp.conf
# แก้ไขบรรทัดที่โดยปิด # server ntp.ubuntu.com# แก้ไขเป็นserver time.navy.mi.th dynamicserver clock.thaicert.nectec.or.th prefer
# อัปเดท time แบบแต่ละครั้งntpdate -u time.navy.mi.th# หรือntpdate -u clock.thaicert.nectec.or.th# ผลที่ได้4 Sep 11:32:21 ntpdate[6973]: adjust time server 203.185.129.186 offset -0.004012 sec
# จากนั้น start service ของ ntp ด้วยคำสั่ง/etc/ntp/init.d/ntp restart
# คำสั่งที่เกี่ยวข้อง ntpdate, ntpq# คำสั่งสำหรับตรวจสอบสถานะของ ntpntpq -p# ผลที่ได้remote refid st t when poll reach delay offset jitter==============================================================================*203.185.129.187 .GPS. 1 u 52 64 17 35.624 -34.446 16.013+203.185.69.60 .PPS. 1 u 56 64 17 11.640 -16.548 15.371118-175-67-83.a .PPS. 1 u 57 64 17 53.176 -23.297 48.676time.nist.gov .ACTS. 1 u 58 64 15 254.304 -26.379 2.935
# referid GPS , PPS, ACTS เป็น Stratum 0# st เป็น Stratum 1# reach ต่ำกว่า 377 จะยังไม่ให้เทียบเวลากับที่ร้องขอให้เทียบเวลา
ntpq -p# ผลที่ได้remote refid st t when poll reach delay offset jitter==============================================================================*203.185.129.187 .GPS. 1 u 21 64 377 4.329 -11.303 14.520+203.185.69.60 .PPS. 1 u 21 64 377 12.253 -16.390 7.395+118-175-67-83.a .PPS. 1 u 18 64 375 53.176 -23.297 39.735+time.nist.gov .ACTS. 1 u 21 64 377 254.304 -26.379 17.683
# สามารถให้เครื่องอื่นเทียบเวลาจาก server เราได้
# กำหนดให้เครื่อง client เทียบเวลาจาก server ที่กำหนด# เครื่อง windows แก้ไขที่ time sync
# เครื่อง linux อื่นๆ เพิ่มค่าในcrontab -e
#แก้ไข config ใน crontab# m h dom mon dow command30 */2 * * * /usr/sbin/ntpdate -u 172.19.192.13

ที่มา http://surat.contentbiz.net/?p=58

วันพุธที่ 21 มกราคม พ.ศ. 2552

BIND DNS Server

1. เข้า webmin tool
2. คลิกที่ Server -> BIND DNS Server ถ้ายังไม่ติดตั้งให้ ติดตั้งเสียก่อน
3. Create master zone

วันพุธที่ 17 ธันวาคม พ.ศ. 2551

แก้การปรับค่าการโชว์ไฟไม่ได้

1. ไปที่ run
2. พิมพ์ regsvr32 /i shell32.dll
3. restart