ps和dw怎么做网站,zend搭建wordpress,17网站一起做网店优势与劣势,河北平台网站建设哪家有在日常使用过程中#xff0c;当有时候需要运行开机自启脚本#xff0c;同时想看到输出结果的时候#xff0c;不免就需要将系统配置为免密登录模式#xff0c;本文主要介绍再init3模式(多用户命令行界面)#xff0c;运行开机自启脚本及输出脚本指令运行数据结果。本文使用的…在日常使用过程中当有时候需要运行开机自启脚本同时想看到输出结果的时候不免就需要将系统配置为免密登录模式本文主要介绍再init3模式(多用户命令行界面)运行开机自启脚本及输出脚本指令运行数据结果。本文使用的系统主要为CentOS7以上、Redhat7以上版本。配置开机免密登录-第一种免密登录方式#切换到gdm目录下找到custom.conf文件[rootlocalhost ~]# cd /etc/gdm/#改目录下有很多文件我们只需要找到custom.confg文件并使用vi打开[rootlocalhost gdm]# lscustom.confg Init PostLogin PreSession Xsession#打印出来看一下该文件内容[rootlocalhost gdm]# cat custom.confg# GDM configuration storage[daemon][security][xdmcp][chooser][debug]#Uncomment the line below to turn on debugging#Enabletrue[rootlocalhost gdm]# vi custom.confg~#找到[daemon]并添加如下内容保存[daemon]AutomaticLoginEnableTrueAutomaticLoginroot #自动登录的用户名-第二种免密登录方式在本案例中不适用再CentOS6版本中可行#切换到getty.target.wants目录并找到gettytty1.service[rootlocalhost ~]# cd /etc/systemd/system/getty.target.wants#该目录下通常就一个文件[rootlocalhost getty.target.wants]# lsgettytty1.service[rootlocalhost getty.target.wants]# vi gettytty1.service~#打开之后寻找[Service]下的ExecStart行并添加--autologin root后保存[Serxice]# the VT is cleared by TTYVDisallocateExecStart-/sbin/agetty --autologin root --noclear %I $TERM.......开机自启脚本-注若是脚本无法运行可关闭Linux的防火墙#打开selinux文件并找到SELINUX行修改后面内容使之disabled[rootlocalhost~]# vi /etc/config/selinux# This file controls the state of SELinux on the system.# SELINUX can take one of these three values;# enforcing - SELinux security policy is enforced.# permissice - SELinux prints warnings instead of enforcing.# disabled - No SELinux policy is loaded.SELINUXdisabled# SELINUXTYPE can take one of these three values;# targeted - Targeted processes are protected.# minimum - Modification of targeted policy.Only selected processes are protected.# mls - Multi Level Security protection.SELINUXTYPEtargeted-第一种方法#再root目录下找到用户配置文件.bash_profile[rootlocalhost ~]# ls -a. .bash_logout ......... .bash_profile ................#打开该文件并将光标移至文件末尾添加自启脚本路径及名称并保存[rootlocalhost ~]# vi .bash_profile# .bash_profile# Get the aliases and functionsif [ -f ~/.bashrc ]; then.~/.bashrcfi# User specific environment and startup programsPATH#PATH:$HOME/binexport PATHsh /root/filenane.sh-第二种方法#切换至 /etc/init.d 目录下并将脚本拷贝到该目录[rootlocalhost ~]# cd /etc/init.d/[rootlocalhost init.d]# cp /root/filename.sh ../init.d/[rootlocalhost init.d]# lsfunctions netconsole network README rhnsd filename.sh[rootlocalhost init.d]# vi filename.sh~#在脚本开头添加如下内容 #chkconfig: 2345 80 90 #description:filename.sh #filename.sh为当前脚本自身名称#在chkconfig工具服务列表中增加此服务[rootlocalhost init.d]# chkconfig --add filename.sh声明本人所写的只是本人在使用中遇到的问题做个记录总结很多内容也是百度或者查阅官方文档若与他人有重复若需按照本文配置请认真确认是否适合你的情况造成一切损失本人概不负责。