ubuntu configuration

8 篇文章 0 订阅
5 篇文章 0 订阅

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 = %S
For 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.10
sudo 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.0
sudo service isc-dhcp-server
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值