Tag Archives: ssh

Redirect Symfony2 LogoutSuccessHandler to original logout target

Questions: I need to modify my user object on logout. To do this, I have a security.yml that contains the following (amongst other things) – #… logout: success_handler: my.logout_success_handler target: / #… …this defines a logout success handler, which is defined in services.yml like this – my.security.logout_success_handler: class: My\Security\LogoutSuccessHandler arguments: [“@security.context”, “@doctrine.orm.default_entity_manager”] …finally, the business-end… Read More »

How do I run SSH commands on remote system using Java?

Questions: I am new to this kind of Java application and looking for some sample code on how to connect to a remote server using SSH , execute commands, and get output back using Java as programming language. Answers: Have a look at Runtime.exec() Javadoc Process p = Runtime.getRuntime().exec(“ssh myhost”); PrintStream out = new PrintStream(p.getOutputStream());… Read More »

Can we use JSch for SSH key-based communication?

Questions: I am using JSch for sftp communication, now i want to use facilitate the key-based authentication, key is loaded on client and server machine once by my network team and all later communication would be only user based for which we have loaded the key. sftp -oPort=10022 jmark@192.18.0.246 as tjill@192.18.0.135 like this command work… Read More »

PHP function ssh2_connect is not working

Questions: Following is my script: <?php $connection = ssh2_connect(‘XX.XX.XX.XX’, 22); ssh2_auth_password($connection, ‘root’, ‘******’); $stream = ssh2_exec($connection, ‘useradd -d /home/users/test -m testftp’); $stream = ssh2_exec($connection, ‘passwd testftp’); $stream = ssh2_exec($connection, ‘password’); $stream = ssh2_exec($connection, ‘password’); ?> It showing the following error: Fatal error: Call to undefined function ssh2_connect() in /home/chaosnz/public_html/fotosnap.net/test.php on line 2 How can I… Read More »

Connect to a MySQL server over SSH in PHP

Questions: I’d like to establish an ssh tunnel over ssh to my mysql server. Ideally I’d return a mysqli db pointer just like I was connecting directly. I’m on a shared host that doesn’t have the SSH2 libraries but I might be able to get them installed locally using PECL. If there’s a way that… Read More »

HTML5 or JQuery Full Screen Crosshair Cursor

Questions: We’ve all seen those military movies with that full screen crosshair cursor on the computers, or even in some animations you see it. For example in the beginning of this video on YouTube titled, “Dishonorable Disclosures” you see exactly what I’m talking about. – https://www.youtube.com/watch?v=X-Xfti7qtT0 Another example is the program “CrossHair 1.1” for Windows… Read More »

Selection Crosshair for Non-Adjacent Cell Selection

Questions: Background: I have a large Excel worksheet in which I created a “crosshair” for easy comparisons between data in the same row and column as the currently selected cell. Most “crosshair” navigation tricks I have seen use formatting, which would either delete or overwrite my existing conditional formatting. My work-around was to use a… Read More »

Reverse Tunnel over JSCH (SSH) and HTTPS

Questions: I have to implement a reverse tunnel from client to server. I have used JSCH with the following command session.setPortForwardingR(rport, lhost, lport); and it works (see also Reverse SSH tunnel with JSCH Java)! next I have to tunnel my ssh session over an HTTPS stream 2-way authenticated: client -> firewall -> apache https ->… Read More »