• 通过建立ssh信任,启动其他客户机的服务


    1:以 root为例

    [root@shell deploy]# ssh-keygen 

    直接回车到底

    通过ssh-cpoy-id自带脚本来拷贝公钥到客户机

    命令格式:

    [root@shell ~]# ssh-copy-id
    Usage: /usr/bin/ssh-copy-id [-i [identity_file]] [user@]machine

    [root@shell ~]# ssh-copy-id -i root@192.168.16.238
    Address 192.168.16.238 maps to localhost, but this does not map back to the address - POSSIBLE BREAK-IN ATTEMPT!

    root@192.168.16.238's password:
    Now try logging into the machine, with "ssh 'root@192.168.16.238'", and check in:

    .ssh/authorized_keys

    to make sure we haven't added extra keys that you weren't expecting.

    注意:客户机不需要进行任何操作,不需要建立.ssh目录

    [root@shell ~]# sh -x ssh_ip.sh 238
    + ssh -p22 192.168.16.238
    Address 192.168.16.238 maps to localhost, but this does not map back to the address - POSSIBLE BREAK-IN ATTEMPT!
    Last login: Mon Jun 8 17:13:33 2015 from 192.168.16.239
    [root@oracle10g ~]#

    我们发现ssh信任已经建立完成

    在客户机查看java进程:

    [root@oracle10g ~]# ps aux|grep java|grep -v grep
    root 21215 0.3 2.0 3342860 76500 ? Sl 17:06 0:02 /usr/bin/java -Djava.util.logging.config.file=/opt/apache-tomcat-6.0.35/conf/logging.properties -server -Xms1048m -Xmx1048m -XX:NewRatio=2 -XX:PermSize=256M -XX:MaxPermSize=512M -XX:+HeapDumpOnOutOfMemoryError -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=16689 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.awt.headless=true -DmqEnable=0 -Deis.run.subsystem=eis_basedata -Deis.import.start=flase -Deis.update.grade.name=true -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/opt/apache-tomcat-6.0.35/endorsed -classpath /opt/apache-tomcat-6.0.35/bin/bootstrap.jar -Dcatalina.base=/opt/apache-tomcat-6.0.35 -Dcatalina.home=/opt/apache-tomcat-6.0.35 -Djava.io.tmpdir=/opt/apache-tomcat-6.0.35/temp org.apache.catalina.startup.Bootstrap start

    pkill -9 java

    在服务机执行:./ssh_ip.sh 238 "servie tomcat start" 或者ssh -t -p 22 192.168.16.238 "/etc/init.d/tomcat start" 

    2:分别在客户机和主机创建test1用户

    useradd test1

    echo "123456" |passwd test1 --statin

  • 相关阅读:
    Highcharts图表使用
    Java——项目定时实现自动截图发送
    Vue错误——export 'XXXX' was not found in './XXXX.js'
    Vue使用——axios封装
    Java selenium错误——org.openqa.selenium.WebDriverException: unknown error: cannot find Chrome binary
    Vue基础——created和mounted的区别
    javascript使用——网页、屏幕的宽和高
    Java错误——java.lang.ArithmeticException: Nonterminating decimal expansion; no exact representable decimal result
    自动收集统计信息任务超时处理
    jquery.validate.js是jquery下的一个验证插件
  • 原文地址:https://www.cnblogs.com/liangsky/p/4561663.html
Copyright © 2020-2023  润新知