Java Process Info - Command

Command to list PID and Working Directory for Java processes

jps | grep -v Jps | while read pid _; do pwdx $pid; done

SSH Configuration for Connection Timeout and Security Settings

SSH Server Configuration (/etc/ssh/sshd_config)

The following settings help manage timeouts, session limits, and authentication attempts for SSH connections:

Configuration Settings:

  1. Key Exchange Algorithms:

    KexAlgorithms -diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1
    
    • This configuration disables certain key exchange algorithms (diffie-hellman-group1-sha1, diffie-hellman-group14-sha1, and diffie-hellman-group-exchange-sha1).
    • It is used to enforce stronger encryption algorithms and prevent weak ones.
  2. Max Startups:

    MaxStartups 10:30:60
    
    • Controls the maximum number of simultaneous unauthenticated connections to the SSH server.
    • 10: Maximum number of unauthenticated connections.
    • 30: Percentage of connections rejected once the limit is reached.
    • 60: The maximum number of unauthenticated connections after which the server blocks new ones.
  3. Max Sessions:

    MaxSessions 10
    
    • Limits the number of open sessions per connection.
    • In this case, a maximum of 10 sessions can be opened per SSH connection.
  4. Max Authentication Tries:

    MaxAuthTries 4
    
    • Limits the number of authentication attempts allowed before disconnecting the client.
    • After 4 failed attempts, the server disconnects the client.
  5. Login Grace Time:

    LoginGraceTime 60
    
    • Specifies the time allowed for a client to authenticate after connecting.
    • The client has 60 seconds to authenticate before the connection is closed.
  6. Client Alive Interval:

    ClientAliveInterval 300
    
    • Controls how often the server sends a "keep-alive" message to the client to prevent disconnection due to inactivity.
    • The server will send a message every 300 seconds (5 minutes).
  7. Client Alive Count Max:

    ClientAliveCountMax 1
    
    • Specifies how many "keep-alive" messages can be missed before the server disconnects the client.
    • With a value of 1, the server will disconnect the client if one "keep-alive" message is missed.

Recommended Adjustments for Longer Inactivity Period:

Apply Changes:

  1. After modifying the sshd_config file, restart the SSH service to apply the changes:
    sudo systemctl restart sshd
    

By adjusting these settings, you can control connection timeouts, improve security, and manage idle time more effectively.



Written by A.M. Rinas