#!/bin/bash PW=\`tr -dc '[:alnum:]' </dev/urandom |head -c6\` while read -p "please input your [username] and [home directory]:" name dir ;do if [ -z "$name" ] ;then echo "Please enter the correct user and directory separated by spaces!" elif [ -z "$dir" ];then echo "Please enter the correct directory!" elif \`id $name &> /dev/null\`;then echo "$name already exist!" elif \`useradd $name -d $dir &> /dev/null\`;then echo $name is created!;echo 123456 |passwd --stdin $name &> /dev/null;echo -e "Username is $name\nHome directory at $dir\nPassord is $PW "; exit 10; else echo "Failed to add user!Please check whether the parameters you entered are correct!" fi done
[root@centos7 while]#sh while_read_useradd.sh please input your [username] and [home directory]:magedu /www magedu is created! Username is magedu Home directory at /www Passord is 0TVpFQ
~ php
#!/usr/bin/expect set user root set PASSWD 123456 set IP 192.168.43.106 set timeout 10 spawn ssh $user@$IP expect { "yes/no" { send "yes\n";exp_continue } "password" { send "$PASSWD\n" } } interact
1.加载BIOS的硬件信息,获取第一个启动设备 2.读取第一个启动设备MBR的引导加载程序(grub)的启动信息 3.加载核心操做系统的核心信息,核心开始解压缩,并尝试驱动全部的硬件设备 4.核心执行init程序(centos7是systemd),并获取默认的运行信息; 5.init程序执行/etc/rc.d/rc.sysinit文件 6.启动核心的外挂模块 7.init执行运行的各个批处理文件(scripts) 8.init执行/etc/rc.d/rc.local 9.执行/bin/login程序,等待用户登陆 10.登陆以后开始以Shell控制主机
方法一:linux
一、启动时任意键暂停启动
二、按e键进入编辑模式 nginx
三、将光标移动linux16开始的行,添加内核参数rd.break
四、按ctrl-x启动
五、系统根被挂载到/sysroot目录下,且为只读挂载,须要从新挂载为读写模式mount –o remount,rw /sysroot docker
六、chroot /sysroot 切根
七、 使用passwd命令改免密passwd root
八、touch /.autorelabel
九、exit
十、reboot centos
方法二: 一、启动时任意键暂停启动 二、按e键进入编辑模式 三、将光标移动linux16开始的行,添加内核参数rd.break 四、按ctrl-x启动 五、mount –o remount,rw /sysroot 六、vi /sysroot/etc/shadow 清空root密码 七、reboot 以后就可使用空密码登陆系统,在修改密码就能够了;
架构班做业:tomcat
一、使用dockerfile制做nginx+php-fpm镜像,实现lnmp。bash
二、使用dockerfile制做tomcat镜像,并实现对jsp测试页访问架构
三、安装配置harbor服务,并将打包好的镜像提交到harbor仓库dom