2009年2月24日 星期二

ubuntu change hostname

#sudo vim /etc/hostname
ubuntu810

#sudo vim /etc/hosts
192.168.11.100 ubuntu810.jiang.com ubuntu810

#sudo reboot

use expect to inteative login ssh server

#sudo apt-get install expect

#sudo vim sshlogin.sh
#!/usr/bin/expect
spawn ssh tommy@192.168.11.100
expect "d:"
send -- "abc12345"
send -- "\r"
expect "*$"
send -- "scp /home/first.txt tommy@192.168.11.100:/home/tommy/"
send -- "\r"
expect eof

install xwindow destkop

#sudo apt-get install ubuntu-desktop
install gdm desktop for ubuntu server

#sudo apt-get install kubunut-desktop
install kde desktop for ubuntu server

2009年2月16日 星期一

Samba Server-SWAT

#sudo apt-get install swat xinetd

#sudo vim /etc/xinetd.conf
insert below lines to xinetd.conf
# default: off
# description: SWAT is the Samba Web Admin Tool. Use swat \
# to configure your Samba server. To use SWAT, \
# connect to port 901 with your favorite web browser.
service swat
{
port = 901
socket_type = stream
wait = no
# Use only_from if you want to restrict access
# only_from = localhost
user = root
server = /usr/sbin/swat
log_on_failure += USERID
disable = no
}

#sudo /etc/init.d/xinetd restart
insert below lines to xinetd.conf

http://localhost:901
browse swat login web page



Samba Server-Introduction

The Samba server is made up of the three daemons:

nmbd

This daemon handles all name registration and resolution requests.

smbd

This daemon handles all TCP/IP-based connection services for file- and print-based operations.

winbindd

This daemon should be started when Samba is a member of a Windows NT4 or ADS domain.It will check idmap uid and idmap gid parameters in /etc/samba/smb.conf.

#testparm /etc/samba/smb.conf
to check syntax for samba configure file.

Samba Server-tdb database

#sudo smbd -b | grep PRIVATE_DIR
the best way to confirm tdb file location

#sudo smbd -b | grep LOCK_DIR
the best way to confirm tdb file location

General Command-ntpdate

#sudo ntpdate pool.ntp.org
Synchronize time with ntp server

#sudo vim /etc/default/ntpdate
# Set to "yes" to take the server list from /etc/ntp.conf, from package ntp,
# so you only have to keep it in one place.
NTPDATE_USE_NTP_CONF=no
###ntpdate-debian doesn't use /etc/ntp.conf###

# List of NTP servers to use (Separate multiple servers with spaces.)
# Not used if NTPDATE_USE_NTP_CONF is yes.
NTPSERVERS="0 pool.ntp.org 1 ntp.ubuntu.org"

# Additional options to pass to ntpdate
NTPOPTIONS="-u"
NTPSERVERS = " 10.10.1.20" ### it will override ntpservers setting ###

#sudo hwclock -w
update BIOS time

#sudo hwclock -r
read time from BIOS

#cp /usr/share/zoneinfo/Asia/Taipei /etc/localtime
modify timezone for Taipei with CST

Dns setting

#sudo vim /etc/resove.conf
search mysite.com #search domain name
nameserver 10.10.1.99 #domain dns server
nameserver 10.10.1.100 #domain dns server
nameserver 168.95.1.1 #Isp provider dns server

Network Setting

#sudo vim /etc/network/interface
# The loopback network interface
auto lo
iface lo inet loopback

#define eth0 use dhcp to obtain ip address
auto eth0
iface eth0 inet dhcp

#define eth0 use static ip address
auth eth0
iface eth0 inet static
address 10.1.1.100 #define ip address
netmask 255.255.255.0 #define netmask
gateway 10.1.1.1 #define gateway

ex: don't forget setting dns server in /etc/resove.conf

#sudo /etc/init.d/network restart (restart network daemon)

General command-update

#sudo apt-get update
update is used to resynchronize the package index files from their sources.
source index file in /etc/apt/ sources.lst

#sudo apt-get upgrade
upgrade is used to install the newest versions of all packages currently installed on the system (include kernel)

#sudo apt-get install package_name
example: sudo apt-get install ssh
install is followed by one or more packages desired for installation.

#sudo apt-get remove package_name
emove is identical to install except that packages are removed instead of installed.