Guide for SSH within OpenELE

SSH or Secure Shell is a basic secured network protocol that enables a secured remote control of a device that has SSH enabled. And because this is a tutorial for people who never worked with it, it doesn’t need a bigger description. You don’t have to be an expert so I’m only going to tell what you can do with it for use with OpenELEC’s XBMC.

The main function we are using SSH now for Openelec.tv’s XBMC is editing the configuration files that enable or define functions like network access, SAMBA, audio, etc. Maybe in the future it will help you with more advanced functions, but then this tutorial will be updated to. Also they’re working on terminal support from within Openelec.tv’s XBMC, which will have the same function as SSH. Only with terminal support, there’s no need for a second computer to log in to Openelec.tv’s XBMC. You just open a terminal for putting in commands. As this is not an option yet, I’ll write this tutorial only with SSH usage for now.

1. Putty

To make a connection with OpenELEC’s XBMC through SSH, we need a program that supports such connections on the computer that is going to make the connection.

I always use the program Putty, which is free and easy to use. All other programs that can work with SSH connections will do the job also, so please feel free to download another program. Putty can be downloaded here:www.chiark.greenend.org.uk/~sgtatham/putty/download.html (for Windows users, download putty.exe).

Once downloaded, store the program in a place where you can find next time. It isn’t a installer so you don’t going to see it in your Programs list.

Double click the icon:

And the following screen will pop up:

The only info we have to give to this program is the IP address which has been given to Openelec.tv’s XBMC, everything else is default at start-up. You can find your IP address within XBMC under “system > system info > network”

After that you hit the Open button and you’ll be directly asked for your login name, which is “root” (without the marks), then give an Enter and the screen asks for your password, which is “openelec” (without the marks). Here you don’t see anything change while typing, it’s ok, just hit Enter again:

” data-mce-href=”http://img686.imageshack.us/img686/2784/putty2.png”>

It’s just like a terminal from Linux, or a command window from Windows, only now you can access the files and put in commands for Openelec.tv’s XBMC.

2. Useful commands

Now that you know how to access Openelec.tv’s XBMC through SSH, here are some useful commands. These commands can be copied inside the terminal, only you have to right click and paste them instead of Ctrl+V (which will not work).

First of all, to see what files and maps there are in the current directory, you can give the following command:

ls -all

” data-mce-href=”http://img19.imageshack.us/img19/6180/putty3.png”>
This will display all files and maps, just like you see them in any operating system, but than without the fancy GUI (displaying pictures of the files)

If you want to go into a map (the purple names), type:

cd <map name>

for example, to go into the videos map, type: cd videos
You can also directly go to a specific map from the root, if you know the exact map names. Ex.: If you want to go to the map movies inside the map videos, just type the following command:

cd videos/movies

where the “/” marks the beginning of the name of that specific map inside the first map. This you can do unlimited, as long as the maps exists. Between every map you place a “/”

To go back one step, for example from /videos/movies to /videos/ use the following command:

cd ..

To go back to the root (where you started when you logged in), use the command

cd

To view a file (white colored) in the terminal (don’t try this with video-, audio- and music files, as it will load an enormous amount of characters) type the following command:

cat <file name>

To edit a file in a specific map that you have loaded, you can use the following command:

nano <file name>

This opens the file and let you edit the lines you want to. It is very basic. To go to a specific line, use the arrows on your keyboard. When done editing and you want to safe the file, press Ctrl+X and type “y”, after that it will ask you which name the file must have and after putting in the right name press Enter.

If you accidentally edited the file, you can say “N” to the question if you want to safe the file and all changes will be discarded.

To make a new (empty) file in a current directory, use the following command:

touch <file name>

Note that most files need an extension for the system to know what it is. For example a configuration file needs the extension “.conf” (like file.conf).

To make a new directory, you can use the following command to make a new (sub)directory in the current directory:

mkdir <map name>

If you are in the root directory, and want to make a specific sub-directory in a map, the following command is needed:

mdir /<existing map>/<new to make map name

Also here you can add as much existing map names as you want, by separating them with a “/”

Removing a directory is the same as making a directory, but instead of “mkdir” you use “rmdir” in the above commands.

If a directory contains lot’s of unwanted data, and you’ll want to delete the whole directory, you may choose to use the following command. It forces a removal of a directory or file. Please use this only when you’re very sure. The following command is based on a current directory that contains the file or directory that will be removed. If you want to use this command from the root directory, just add all the map names to the file or directory (ex. /<directory1>/<directory2>/ etc.) before the <directory or file name> without a space.

rm -rf <directory or file name>

To remove a separate file, use the following command:

rm <file name>

To copy a file to a specific place on the same computer, use the following command:
This command will copy <file name> in the current directory to <directory2>, which is in <directory1>, which is in the root directory. The “~” in this command tells SSH to go first to the root directory, from there you have given the navigation to the file.

cp <file name> ~/<directory1>/<directory2>/

If you want to copy a file to a directory that is within the same directory as the goal directory (ex. you want to copy from /videos/ to /videos/drama/foreign/), you can also use the above code without the “~”. Please note that <directory1> will now be the map /drama/ and <directory2> will be /foreign/, because we don’t go back to the root directory.

The above code can also be used for moving a file, just replace “cp” in “mv”.

If you want to display your current TCP/IP configuration (such as you IP address, used network device, etc.) (just like ipconfig on Windows), type the following command:

ifconfig

3. Now we’re going to show you some more advanced commands, most of them you only need when you’re facing some problems and want to find out what it causes.

Displaying CPU and memory usage by the system can be done with the following command:

top

You’ll get the following screen

To sort the list by memory usage, use the following key combination: Shift+m

To sort the list by CPU usage, use the following key combination: Shift+p

To exit this screen, use the following key combination: Shift+q

I know most of you will not know what everything in this screen will tell, but most of you know when you have a very high percentage CPU or memory usage, that that particular process is not working well. So when you report a bug or ask for help, you’ll have detailed info which you can give for a solution!

To print a whole list of active processes, can be displayed with the following command:

ps -ef

If you add “|more” after “-ef”, the list will pause when the terminal window is full. Press any key to resume (if the list is too long, it will pause again when the terminal window is full)

Add “|grep <name>” after “-ef” to filter the list. This will show only the processes containing the word <name>

Add “|grep -v <name>” after “-ef” to filter the list. This will show only the processes that not contain the word <name>

A list of Kernel messages can be displayed with the following command:

dmesg

To safe this Kernel messages to a file, use the following command:

dmesg >>dmesg.txt

This file will be saved in the current directory, it can be wise to go to a specific directory (that is for example accessible by SAMBA) to safe this file.

To view common log-files of the system, use the following command to enter the directory that’s containing them:

cd /var/log

For a live-view of an existing log-file (new added data will be shown directly and automatically scroll down), type:

tail -f <log-file>

Notice that the above command will only work in the current directory of the log-file. To use this command from root, give also the containing directories as described before.

To exit the live view, use the following combination “Ctrl+c”

To see under which name you’re currently logged in, use the following command:

whoami

This how-to will be filled with new commands from time to time. If you think that you’re missing something, please let me know and I’ll add it. We’ll use only the commands that will be useful with Openelec’s XBMC.

Planned to add in this how-to:

-copy files from an external computer over SSH
-wgetpaste
-htop

About cagex007

Check Also

Discover the Power of Vseebox Pro Max! Unboxing & Review of this Incredible Android TVbox Combo

Unlock the ultimate entertainment experience with the Vseebox Pro Max Android TVbox Combo! 📺 In …

Leave a Reply

Your email address will not be published. Required fields are marked *