简体   繁体   中英

Crash shell - configuration and use

I have an application called ROCServerEntrypoint which is using spring-boot. I'd like to run this Spring Boot application that embeds CRaSH shell. I have added the following maven dependency.

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-remote-shell</artifactId>
    <version>1.3.3.RELEASE</version>
</dependency>

As required I have added the following configuration in my spring beans.xml to enable remote access via SSH.

   <bean class="org.crsh.spring.SpringWebBootstrap" scope="prototype">
            <property name="config">
                <props>
                    <prop key="crash.telnet.port">5000</prop>
                    <!-- VFS configuration -->
                    <prop key="crash.vfs.refresh_period">1</prop>
                    <!-- SSH configuration -->
                    <prop key="crash.ssh.port">2000</prop>
                    <!-- Authentication configuration -->
                    <prop key="crash.auth">simple</prop>
                    <prop key="crash.auth.simple.username">admin</prop>
                    <prop key="crash.auth.simple.password">admin</prop>
                </props>
            </property>
        </bean>

</beans>

I am lost as to how to go about it next. I'm new to linux system concepts. Kindly explain briefly what does it mean to access it remotely and how does crash shell helps in this?

Also,Tried connected via SSH, it throws the following

[priyanka@priyanka-ux programs]$ ssh -p 2000 admin@localhost
ssh: connect to host localhost port 2000: Connection refused

Is there something I'm missing here?

I'm not allowed to comment yet, so I must put it into an answer:

Did you already solve your problem?

CRaSH can be added for connecting to a running application and query management or other information remotely. Simplified remote often means from another computer using some kind of terminal program. But "remote" might be from the local system as well, like you are trying.

You might want to check the CRaSH reference .

If your problem still exists, some tips which might help to locate the problem:

  1. Make sure your program is running
  2. Check your log file or system.out for any errors and/or some line containing " [...] .CrshAutoConfiguration$CrshBootstrapBean [...] "
  3. Try without your own CRaSH configuration and use spring boot autoconfiguration to check if it is working at all with default settings
  4. If you don't want to tinker with your application, use a simple test application just to check if CRaSH is initialized properly. Something like the following might be enough (assuming you've added spring-boot-starter-remote-shell as dependency as you did!)

     import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.websocket.WebSocketMessagingAutoConfiguration; @SpringBootApplication(exclude = { WebSocketMessagingAutoConfiguration.class }) public class Application { public static void main(String[] args) throws Exception { SpringApplication.run(Application.class, args); } } 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM