In Midnight Commander when you press ctrl + \ you can access directory hotlist and you can quickly choose connection you want to establish.

The problem is – you cannot by default save passwords, so every time you select this connection you need to input it. Sure, it’s safe to do so, but if using them in your desktop and you’re the only user of it – you can expect a bit more pragmatic approach.

You can define your site’s password explicitly in the MC configuration file which, by default, resides in ~/.config/mc/hotlist.

Just edit this file and you’ll see entry similar to below:

Continue reading

If you want to remotely access your SSH account (e.g. NAS in home) and listen to the music or watch some movies without downloading them in the first place, you can use the following command:

ssh user@your.host.com cat mediaFile.avi | mplayer - 

It will connect to your.host.com, log into the user account, invoke the cat command on the given mediaFile.avi and transfer the output (stream of bytes) to your local mplayer.

The mplayer - says that it should read the data from the standard input — which in this case is the result of the cat command.
When you finish watching or listening — just break the connection and no traces are left on your local device.

Alternatively, you can also mount your remote ssh location using the sshfs.

If you want to execute a GUI based application on the remote server through SSH, you can achieve it quite easily using the ssh command. Just type

ssh -X username@server

The -X flag is used to define the DISPLAY environmental variable on the remote host, so each X11 executed application will be forwarded to your machine.

Recently I needed to find out what GNU/Linux a terminal-only server is using. The most obvious thing I could think of was to use:

uname -a

Unfortunately, it will return the kernel information only – no details about the distribution though.
The distribution info is located in a different file which is dependent on… the distribution itself. Check out the list of those filenames here.

As a majority of those files ends with “release” part, in most cases it should be enough to execute the following command:

cat /etc/*release

I was trying to find a way to capture the network interface traffic on a remote server, just to see what (or who!) messed up the Web Services based communication.

I didn’t have to search too long, because my favorite capturing software, Wireshark, can listen on a named pipe. So, below you can find the simplest solution I found (SSH + FIFO) [based on this tutorial]:

On the client side (my computer – GNU/Linux) type:

mkfifo /tmp/pipe
ssh user@remote-host "tshark -w - not port 22" > /tmp/pipe

Still on the client side, open another terminal and type:

wireshark -k -i /tmp/pipe

Now type the SSH password in the first terminal. Of course you don’t have to do this if you have configured your connection to use the certificates.

Just remember that on the server side you need to install the console-version of the Wireshark named tshark and to log in as a user which has privileges to capture the network traffic.

Now using your client-side Wireshark you can listen to the traffic which comes to and from your remote server.

Sometimes, when building an application, there is a need for some SSH command execution on the remote server. An example of such command could be:

- Redeployment of an application,
- Server restart,
- Temporary files removal,
- Custom script execution.

Have no fear – SSHExec is here!

You can easily achieve remote command invocation, using an ANT Task sshexec. An example of its usage could be this snippet (note that remote.* variables are taken from the *.properties file in this case):

<sshexec host="${remote.host}"
         username="${remote.user}"
         password="${remote.pass}"
         trust="true"
         command="rm -rf ${remote.webapps.path}/ROOT*" />

You can read about more detailed examples here.

To add this feature to your ANT installation, you need to download the JSch – Java Secure Channel library and include the jsch jar file into ANT classpath (i.e. in your ANT_HOME/lib/ or — if you’re using an Eclipse — into Eclipse Ant classpath).

I found this feature quite useful as it reduced time I needed to build and deploy an application.