TOPIC: [GUIDE] Guide for SSH within OpenELEC

[GUIDE] Guide for SSH within OpenELEC 3 years 4 months ago #1

  • therio
  • therio's Avatar
  • OFFLINE
  • Staff
  • Posts: 2160
  • Thank you received: 179
  • Karma: 78
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:





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





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
A thank you is nice, but a donation is more needed ;)
Thanks in advance!!
Last Edit: 3 years 4 months ago by MindTooth. Reason: Typos in subject.
The administrator has disabled public write access.
The following user(s) said Thank You: MindTooth, Golfman227, , musicmaya, incubus, crashtext, Widget21

Re: [GUIDE] Guide for SSH within Openelec 3 years 4 months ago #2

  • MindTooth
  • MindTooth's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 400
  • Thank you received: 7
  • Karma: 3
Thank you :) This can really be of help for many OpenELEC newcomers.
The administrator has disabled public write access.

Re: [GUIDE] Guide for SSH within Openelec 3 years 4 months ago #3

  • terminalx
  • terminalx's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 18
  • Thank you received: 1
  • Karma: 1
Good guide! yet Terminal is fine, but the cheat remains $ mc ..is this something you would consider to include in openelec? Of course it defies the purpose maybe of a light install but midnight commander goes a long way back to my commodore 64 :) and norton commander..B)
Last Edit: 3 years 4 months ago by terminalx.
The administrator has disabled public write access.

Re: [GUIDE] Guide for SSH within OpenELEC 3 years 4 months ago #4

  • MindTooth
  • MindTooth's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 400
  • Thank you received: 7
  • Karma: 3
What do you mean? SSH is included.
The administrator has disabled public write access.

Re: [GUIDE] Guide for SSH within OpenELEC 3 years 4 months ago #5

  • terminalx
  • terminalx's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 18
  • Thank you received: 1
  • Karma: 1
yes. Sorry- this is my bad and going of topic.


mc
The administrator has disabled public write access.

Aw: [GUIDE] Guide for SSH within OpenELEC 3 years 1 month ago #6

  • heavydz
  • heavydz's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 26
  • Thank you received: 1
  • Karma: 0
yes- please midnight commander :)

and THANKS for this short guide into useable commands!!!
===============
LIVINGROOM1 BOX: OpenELEC 3.0.2 ION x86 on ASUS at3iont-i deluxe, 4GB Ram, Terratec S7, 64GB SSD
LIVINGROOM2 BOX: OpenELEC 3.0.2 ION x86 on POV ion, 2GB Ram, Tevii S470, 2 TB SATA (for important Backups)
OUTDOORBOX: OpenELEC 3.0.2 AppleTV1
SERVER: OpenELEC 3.0.2 INTEL 64bit 8TB
Last Edit: 3 years 1 month ago by heavydz.
The administrator has disabled public write access.

Re: [GUIDE] Guide for SSH within OpenELEC 2 years 4 months ago #7

  • schimi2k
  • schimi2k's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 34
  • Thank you received: 2
  • Karma: 0
Hello :)
first of all - BIG THX 4 the Tut ! very nice, BUT

how can i activate SUDO in Putty ? every time i want sudo, it says " -sh: sudo: not found

i want to copy some webinterface files in the default folder, but without owner rights i cant do it, and my linux skills are very... BAAAADDD :(

big THX in advance
My HTPC:
Asus E35M1-I Deluxe - 4GB Ram
Hauppauge WinTV-NOVA-T-Stick
VRC-1100 Remote - General Keys Keyboard/Tp Kombo
Main System on 120GB HDD Dual with Win7
Test System with newest Nightly Builds on USB-Stick
The administrator has disabled public write access.

Re: [GUIDE] Guide for SSH within OpenELEC 2 years 4 months ago #8

  • ultraman
  • ultraman's Avatar
  • OFFLINE
  • Developer
  • Posts: 3291
  • Thank you received: 578
  • Karma: 237
schimi2k, you are already root when you log on to openelec. That's why you don't need to use sudo at front.
ultraman == vpeter
Spotify build instructions
my Opera web browser addon (not for RPi)
Sundtek and HDHomeRun DVB driver addons
TBS, media_build, s2-liplianin unofficial images
The administrator has disabled public write access.
The following user(s) said Thank You: schimi2k

Re: [GUIDE] Guide for SSH within OpenELEC 2 years 4 months ago #9

  • schimi2k
  • schimi2k's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 34
  • Thank you received: 2
  • Karma: 0
thx for the fast reply :)

i want to copy 2 webinterfaces subfolder in the webinterface.default folder ( awx and xwmm )

i used this command:
cp -r /.xbmc/addons/webinterface.awx ~/usr/share/xbmc/addons/webinterface.default/

then i get this error:
cp: can't create directory '/usr/share/xbmc/addons/webinterface.default/webinterface.awx': Read-only file system

i try also: chmod 777 /usr/share/xbmc/addons/webinterface.default

but the same error ( read only )

mybe someone can give me a little tip ??
again thx in advance
My HTPC:
Asus E35M1-I Deluxe - 4GB Ram
Hauppauge WinTV-NOVA-T-Stick
VRC-1100 Remote - General Keys Keyboard/Tp Kombo
Main System on 120GB HDD Dual with Win7
Test System with newest Nightly Builds on USB-Stick
The administrator has disabled public write access.

Re: [GUIDE] Guide for SSH within OpenELEC 2 years 4 months ago #10

  • therio
  • therio's Avatar
  • OFFLINE
  • Staff
  • Posts: 2160
  • Thank you received: 179
  • Karma: 78
You're trying to copy to the system partition. This is read-only for safety reasons. Isn't this webinterface downloadable through the add-ons repo?
A thank you is nice, but a donation is more needed ;)
Thanks in advance!!
The administrator has disabled public write access.

Re: [GUIDE] Guide for SSH within OpenELEC 2 years 4 months ago #11

  • schimi2k
  • schimi2k's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 34
  • Thank you received: 2
  • Karma: 0
thx again :)
yes, it can be downloaded per openelec addons - BUT you can activate just one ! if you want awx you must aktivate it in SYSTEM-Network ( or xwmm )
but i want both activatet and select them in my Browser with (IP:port/awx/index or IP:port/xwmm/index)
i read it in a xbmc forum, but i think its only possible when u launch xbmc direct in Windows

well thx anyway :) if someone got an idea to make my "wish" possible - feel free to share ;)
My HTPC:
Asus E35M1-I Deluxe - 4GB Ram
Hauppauge WinTV-NOVA-T-Stick
VRC-1100 Remote - General Keys Keyboard/Tp Kombo
Main System on 120GB HDD Dual with Win7
Test System with newest Nightly Builds on USB-Stick
The administrator has disabled public write access.

Re: [GUIDE] Guide for SSH within OpenELEC 2 years 3 months ago #12

  • markguy
  • markguy's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 10
  • Karma: 0
Is there a setting to allow SSH connections I'm not seeing? When I try to reach an OpenELEC box on my network (one that pings just fine), I get "Network error: Connection refused".
The administrator has disabled public write access.

Re: [GUIDE] Guide for SSH within OpenELEC 2 years 3 months ago #13

  • Acestes
  • Acestes's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 47
  • Thank you received: 6
  • Karma: 3
Are you using one of the newer builds? If you are, SSH has been disabled by default. You can enable it by creating a blank file called 'ssh_enable' in the 'Config Files' share.
Pioneer PDP-436XDE 43" Plasma TV - Onkyo TX-NR709 - Acer Revo 3700 - Atom D525 1.8Ghz dualcore 2GB RAM Nvidia ION2 - ORtek VRC-1100 & Harmony 900 - OpenELEC Unofficial Frodo Development Build
The administrator has disabled public write access.
The following user(s) said Thank You: markguy

Re: [GUIDE] Guide for SSH within OpenELEC 2 years 3 months ago #14

  • markguy
  • markguy's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 10
  • Karma: 0
Err, yes, I am (OpenELEC-Generic.i386-devel-20111228035417-r9365). Apologies for not including that information and thanks for the tip.

EDIT: For anyone else suffering the same issue, here's the FAQ entry for same.
Last Edit: 2 years 3 months ago by markguy.
The administrator has disabled public write access.

Re: [GUIDE] Guide for SSH within OpenELEC 2 years 3 weeks ago #15

  • Angi321
  • Angi321's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 44
  • Thank you received: 2
  • Karma: 2
The guide is very useful especially for some commands that are available. Thank you!
However it is made only for putty/windows users.

I am trying to get around in MAC or Linux.
For instance in OsX terminal I type sudo ssh This email address is being protected from spambots. You need JavaScript enabled to view it. (which is the HTPC's IP) then I get a password prompt. I type openelec or root and on both entries I have "wrong password".
Where am I mistaken?
Ang
Last Edit: 2 years 3 weeks ago by Angi321.
The administrator has disabled public write access.

Our Sponsors & Partners

arctic_logo