Create new user and set a expired passwd
#!/bin/bash
if [ $# -ne 1 ]
then
echo "Usage $0 <username>"
exit 3
fi
usr=$1
sudo useradd -m -s /bin/bash -G devgrp ${usr}
echo "${usr}":"pw${usr}" | sudo chpasswd
sudo passwd -e ${usr}
Configure auto start services
usage: update-rc.d [-n] [-f] remove update-rc.d [-n] defaults [NN | SS KK] update-rc.d [-n] start|stop NN runlvl [runlvl] [...] . update-rc.d [-n] disable|enable [S|2|3|4|5] -n: not really -f: force
update grub
We should count the menuentry manually(/boot/grub/grub.cfg submenu can include lots of menuentry, but it is counted once)
Then index number starts from 0
--- /etc/default/grub.old 2014-01-15 21:42:27.991155540 +0800
+++ /etc/default/grub 2014-01-15 22:00:01.127139557 +0800
@@ -3,7 +3,7 @@
# For full documentation of the options in this file, see:
# info -f grub -n 'Simple configuration'
-GRUB_DEFAULT=5
+GRUB_DEFAULT=0
#GRUB_HIDDEN_TIMEOUT=0
sudo update-grub
samba
/etc/samba/smb.conf You knew it. Only security and [homes] are not default, the others are default. In this configuration, all the \\server\\username can be accessed.
[global] workgroup = WORKGROUP server string = %h server (Samba, Ubuntu) dns proxy = no log file = /var/log/samba/log.%m max log size = 1000 syslog = 0 panic action = /usr/share/samba/panic-action %d security = user encrypt passwords = true 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 [homes] comment = %U Home Directories browseable = Yes read only = no create mask = 0660 directory mask = 0700 valid users = %SFor other user(not the user created during the OS installation but created with user add)
We still need to sudo smbpasswd -a <username>
Could we use unix user dirctly?
Test samba
Linux command line
smbclient -L <IP> -U guest -N #list
smbclient -L <IP> -U <username> #list
smbclient \\<IP>\<username> -U <username> # login
Windows
You may get 'Multiple connections' or 'disconnect previous connections' error in windows
rem list the connections
net use
rem remove all the connections
net use * /delete
dhcp server
Test on ubuntu 11.10sudo apt-get install dhcp3-server
sudo vim /etc/default/isc-dhcp-server
INTERFACES="eth0"sudo vim /etc/dhcp/dhcpd.conf
ddns-update-style none; # option definitions common to all supported networks... option domain-name "example.org"; option domain-name-servers ns1.example.org, ns2.example.org; default-lease-time 600; max-lease-time 7200; # If this DHCP server is the official DHCP server for the local # network, the authoritative directive should be uncommented. #authoritative; # Use this to send dhcp log messages to a different log file (you also # have to hack syslog.conf to complete the redirection). log-facility local7; option subnet-mask 255.255.0.0; option broadcast-address 190.99.0.255; option routers 190.99.0.1; subnet 190.99.0.0 netmask 255.255.255.0 { range 190.99.0.142 190.99.0.154; }sudo vim /etc/network/interfaces
auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 190.99.0.141 netmask 255.255.0.0sudo service isc-dhcp-server