九、Linux系统启动管理与密码破解
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了九、Linux系统启动管理与密码破解,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2574字,纯文字阅读大概需要4分钟。
内容图文
1.编写脚本,接受二个位置参数,magedu和/www,判断系统是否有magedu,如果没有则自动创建magedu用户,并自动设置家目录为/www。
[root@localhost /data]#./createusertest.sh
Please Input 2 Args,Usage:./createusertest.sh magedu /www.
[root@localhost /data]#./createusertest.sh magedu /www
The User magedu is created.
[root@localhost /data]#cat /etc/passwd |grep magedu
magedu:x:2013:2013::/www:/bin/bash
[root@localhost /data]#./createusertest.sh magedu /www
Error,The User magedu maybe existed,Check it.
[root@localhost /data]#cat createusertest.sh
#!/bin/bash
#********************************************************************
#Author: Kevin.Wen
#Revision: 1.0
#QQ: 2510905014
#Date: 2020-11-10
#FileName: createusertest.sh
#********************************************************************
if [ $# != 2 ];then
echo "Please Input 2 Args,Usage:./createusertest.sh magedu /www."
exit
fi
id $1 &> /dev/null
if [ $? != 0 ];then
useradd $1 -d $2
echo "The User $1 is created."
else
echo "Error,The User $1 maybe existed,Check it."
fi
2.使用expect实现自动登录系统。
[root@localhost /data]#./ssh.sh
spawn ssh root@10.0.0.111
The authenticity of host '10.0.0.111 (10.0.0.111)' can't be established.
ECDSA key fingerprint is SHA256:kAt7IKd1y+BNs+aq6c7ZGPJSN0yJ1RDTwqIYfB4KZV8.
ECDSA key fingerprint is MD5:c2:0f:f6:82:fb:0d:83:69:c5:ae:cd:6c:0b:9f:48:ce.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.0.0.111' (ECDSA) to the list of known hosts.
root@10.0.0.111's password:
Last login: Tue Nov 10 11:37:16 2020 from 10.50.100.12
[root@localhost ~]# exit
logout
Connection to 10.0.0.111 closed.
[root@localhost /data]#cat ssh.sh
#!/usr/bin/expect
#********************************************************************
#Author: Kevin.Wen
#Revision: 1.0
#QQ: 2510905014
#Date: 2020-11-10
#FileName: ssh.sh
#********************************************************************
set timeout 3
set PASS "123456"
spawn ssh root@10.0.0.111
expect {
"yes/no" { send "yes\n";exp_continue }
"password:" { send "$PASS\n";exp_continue }
}
interact
3.简述linux操作系统启动流程.
/sbin/init --> (/etc/inittab) --> 设置默认运行级别 --> 运行系统初始脚本/etc/rc.d/rc.sysinit、完成系统初始化 --> (关闭对应下需要关闭的服务)启动需要启动服务/etc/rc#.d/Sxxxx,/etc/rc.d/rc.local--> 设置登录终端
4.破解centos7 密码。
启动时任意键暂停启动
按e键进入编辑模式
将光标移动linux 开始的行,添加内核参数rd.break
按ctrl-x启动
mount –o remount,rw /sysroot
chroot /sysroot
passwd root
#如果SELinux是启用的,才需要执行下面操作,如查没有启动,不需要执行
touch /.autorelabel
exit
reboot
内容总结
以上是互联网集市为您收集整理的九、Linux系统启动管理与密码破解全部内容,希望文章能够帮你解决九、Linux系统启动管理与密码破解所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。