#!/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