zhousir1991

让开源路人皆知~!
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

kickstart, inode ,sshd,软硬链接

Posted on 2011-08-01 18:19  zhousir1991  阅读(446)  评论(0编辑  收藏  举报
kickstart //自动安装系统,这里以PXE作介绍
首先生成一个ks.cfg文件
[root@desktop26 ~]# ksvalidator //校验
[root@desktop26 ~]# ll anaconda-ks.cfg 
-rw-------. 1 root root 4541 Jul 29 01:27 anaconda-ks.cfg  //模板
通过Appache发布ks.cfg文件
[root@desktop26 ~]# mv ks.cfg /var/www/html/
接下来新建虚拟机 在选择标准安装时按下Tab键,进行编辑 写上:ks=http://192.168.0.26/ks.cfg
如果想用光盘,优盘,可以把 boot.iso 用dd命令,截取到相应的块设备上去,作启动引导
再谈远程登录sshd服务
[root@desktop26 ~]# ssh -X student@192.168.0.2 firefox  // -X 转发图形的ssh
[root@desktop26 ~]# w                            //当前登录仿真终端的用户
 16:45:00 up 19 min,  4 users,  load average: 0.06, 0.05, 0.07
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
student  tty1     :0               16:26   19:23  11.81s  0.10s pam: gdm-passwo
student  pts/0    :0.0             16:44    8.00s  0.01s  0.01s /bin/bash -l
root     pts/2    desktop27.exampl 16:44   10.00s  0.05s  0.05s -bash
root     pts/3    desktop26.exampl 16:44    1.00s  0.09s  0.07s w
[root@desktop26 ~]# last                        //查看最近登录的记录
student  pts/0        :0.0             Thu Jul 28 18:10 - 18:11  (00:01)    
student  pts/2        :0.0             Thu Jul 28 18:05 - 18:09  (00:03)    
student  pts/0        :0.0             Thu Jul 28 17:29 - 18:05  (00:36)    
student  tty1         :0               Thu Jul 28 17:29 - 18:12  (00:42)    
reboot   system boot  2.6.32-71.el6.x8 Thu Jul 28 17:28 - 18:19  (00:51)    
wtmp begins Thu Jul 28 17:28:44 2011
[student@desktop26 Desktop]$ ssh 192.168.0.27
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
db:7d:f4:73:4d:6e:d8:72:b5:21:cb:5d:42:59:41:df.
Please contact your system administrator.
Add correct host key in /home/student/.ssh/known_hosts to get rid of this message.
Offending key in /home/student/.ssh/known_hosts:1
RSA host key for 192.168.0.27 has changed and you have requested strict checking.
Host key verification failed.
出现这个是什么情况呢??? 
原因是:对方重启过sshd服务,使得/etc/ssh/下公私钥与本地的不匹配(如下:)
[student@desktop27 ~]$ ls /etc/ssh/
ssh_config            ssh_host_dsa_key.pub  ssh_host_rsa_key
sshd_config           ssh_host_key          ssh_host_rsa_key.pub
ssh_host_dsa_key      ssh_host_key.pub 
解决办法是,删除本地主目录下.ssh/下的known_hosts文件,或者known_hosts文件中相对应的记录
[student@desktop27 .ssh]$ ls
known_hosts                         //编辑或者删除该文件
[student@desktop27 .ssh]$ ssh student@192.168.0.27
Read from socket failed: Connection reset by peer
出现这个又是什么情况呢???  做了个测试:
应该是对方把/etc/ssh/下所有的公钥私钥全部删除了。解决办法是让对方重启该服务
[root@desktop26 ~]# tune2fs -l /dev/sda1|less       //less是以分屏模式看看i节点号
Inode count:              25688
[root@localhost mnt]# touch file
[root@localhost mnt]# ln -s file file1             //作软链接
[root@localhost mnt]# ln file file2               //作硬链接
[root@localhost mnt]# ll -i                       //-i查看节点号
total 0
11602 -rw-r--r--. 2 root root 0 Aug  2 07:33 file
11933 lrwxrwxrwx. 1 root root 4 Aug  2 07:34 file1 -> file
11602 -rw-r--r--. 2 root root 0 Aug  2 07:33 file2
可以发现,硬链接的inode号,是一样的,而软链接不一样,而且当源文件删除时,硬链接所指的文件与源文件相同
所以必须把相应的硬链接全部删除,才算完全删除。另外软链接可以跨分区,链接文件夹,而硬链接不行。