半冷半暖秋天

2010-10-13

SecureCRT 颜色及字体调整

Filed under: linux相关,文档及资源 — sunu @ 10:07:45

 默认的字体及颜色极丑, 默认编码是ANSI,如果远程主机Locale是UTF-8的,则中文乱码。

1. 字体及乱码
  右键“会话选项”,“终端”,“外观”,“字体”,“标准字体”选择”fixedsys”,字体编码选择“UTF-8″。

2. shell颜色及vim颜色
 右键“会话选项”,“仿真”,终端选择”ansi”(必须是ansi,否则vim无法语法高亮,起码ubuntu 10.10是这样),选中“ansi颜色”。

 如此一来就跟putty差不多的效果了。
securecrt_color_font

2010-05-21

使用文件做为密钥,cryptsetup加密分区

Filed under: linux相关 — 标签:, — sunu @ 20:53:01

上次记录在:http://www.fqyy.org/sunu/archives/549.html

使用文件做为密钥。

1. 准备个文件,可以是任意内容(真的是任意)
#echo “fsdfsdfasdf” > /tmp/myKey.dat

2. 使用这个文件做为口令加密/dev/sdc2分区, 所以这个文件千万千万不能弄丢,也不能被修改
/sbin/cryptsetup.static –batch-mode –key-size=256 luksFormat /dev/sdc2 /tmp/myKey.dat

3. 打开加密分区,打开后就可以使用/dev/mapper/mydisk了,像其它任何/dev/sdx*一样
/sbin/cryptsetup.static luksOpen /dev/sdc2 mydisk –key-file /tmp/myKey.dat

4. 关闭加密分区
/sbin/cryptsetup.static luksClose /dev/mapper/mydisk

grub2安装出错记录

Filed under: linux相关 — 标签: — sunu @ 20:44:02

出错消息:Your embedding area is unusually small. core.img won’t fit in it.
出错原因:硬盘第一个分区前需要起码要留出63个扇区(sector)给GRUB2使用。
解释来源:http://bbs.archlinux.org/viewtopic.php?pid=761740

2010-04-04

svn搭建源码仓库

Filed under: linux相关 — 标签:, , — sunu @ 20:10:11

http://subversion.tigris.org/ 下载subversion及tortoiseSVN。

安装服务端(windows命令相同)
1. 创建仓库
svnadmin create /root/svn_host

2.修改svn配置文件
vim /root/svn_host/conf/svnserve.conf
[general]
anon-access = none
auth-access = write
password-db = passwd
realm = My First Repository

3. 修改用户配置文件
vim /root/svn_host/conf/passwd
[users]
user=password
可以添加多个这样的用户名密码对。

4.运行SVN服务
svnserve -d -r /root/svn_host

安装客户端
一路Next安装tortoiseSVN

访问SVN
1. 在tortoiseSVN中输入路径svn://10.22.65.138/或者其下子目录.
2. 在不同的子目录中可管理不同项目的源码.

2010-03-07

将linux安装于加密分区上

Filed under: linux相关 — 标签:, , — sunu @ 15:10:36

目的:将linux安装在加密的分区中,使得即使硬盘丢失别人也无法获取数据。陈老师肯定很喜欢。。。
实现:

  1. 使用encryptset系列工具创建加密分区
  2. 复制系统所有文件到加密后的分区
  3. 创建initrd,放在未加密的分区中,用grub引导

1. 首先需要准备以下工具
cryptsetup(cryptsetup-luks)
device-mapper
util-linux

2. linux内核必须要加载aes模块

root[~]#modprobe aes
root[~]#cat /proc/crypto | grep aes

name      : aes
driver    : aes-asm
module    : aes_i586
name      : aes
driver    : aes-generic
module    : aes_generic

3. 加密分区

root[~]#cryptsetup –verbose –verify-passphrase -c aes-cbc-plain luksFormat /dev/sda2

输入密码。

4. 挂载+格式化+复制系统文件

root[~]#cryptsetup –verbose –verify-passphrase -c aes-cbc-plain luksFormat /dev/sda2
root[~]#cryptsetup luksOpen /dev/sda2 mydisk
root[~]#ls /dev/mapper/
control mydisk
root[~]#mkfs.ext4 /dev/mapper/mydisk -O uninit_bg -E lazy_itable_init=1
root[~]#mkdir -p /mnt/mydisk;
root[~]#mount /dev/mapper/mydisk /mnt/mydisk
root[~]# … 复制所有系统文件到 /mnt/mydisk中

4. 创建initrd
grub是不支持从crypt_LUKS加密分区启动的,所以需要准备一个单独的未加密小分区存放内核和initrd.

root[~]#mkinitrd //会在/boot/下生成initrd-tree目录,是最简单的initrd目录结构
root[~]#cd /boot/initrd-tree
root[~]# … //修改文件:luksdev为加密分区/dev/sda2, rootfs为ext4, rootdev为/dev/mapper/mydisk
root[~]# … //复制静态版的cryptsetup及device-mapper完整地到 initrd-tree相应的目录下.
root[~]# … //因为在initrd-tree/init启动脚本中会使用到,用来打开加密的分区,而默认的initrd中是没这些工具的
root[~]# … //复制内核的aes模块文件 /lib/modules/版本/kernel/crypto/* 及/lib/modules/版本/kernel/arch/x86/crypto/*到initrd-tree/lib/下。如果内核已经内嵌了aes则不需要了
root[~]#mkinitrd //再次运行mkinitrd会将/boot/initrd-tree打包成/boot/initrd.gz

5. 在grub启动中加上initrd /boot/initrd.gz
如此一来,在启动的过程中,将会提示输入密码.如果密码不对,则系统不会启动。

Powered by WordPress