Author Topic: How to use ssh to work on remote files on the core?  (Read 2952 times)

jondecker76

  • Alumni
  • wants to work for LinuxMCE
  • *
  • Posts: 763
    • View Profile
How to use ssh to work on remote files on the core?
« on: February 16, 2008, 05:01:02 am »
I want to start poking around a little bit. My core is stashed in a closet, so I need to edit files on another machine on the network. I just don't know how to do it...

So far I can
ssh linuxmce@192.168.80.1

and I'm at the terminal on the core. However, I don't know how to open those files on my local machine...
For example, if there is a file /temp.txt on the core, and I want to use gedit on my local machine to edit it.. I've tried:

sudo gedit /temp.txt

but I get an error that I have to specify a display.

What do I do? Am I going about this right?

royw

  • Guru
  • ****
  • Posts: 261
    • View Profile
Re: How to use ssh to work on remote files on the core?
« Reply #1 on: February 16, 2008, 06:08:42 am »
When I'm feeling gui'ish, I'll open konqueror and use the fish kioslave.  Usually very limited in usability as most interesting linuxmce files require root access.

So what I do mostly is just ssh and edit on the core using vim.

For more major edits (i.e., sets of files), I'll copy them to my workstation using scp, make my edits (usually with kate), then copy them back again with scp.

If you really want to edit the files in place on the core, but from your workstation, then you could use sshfs (ssh over fuse) to mount the core's filesystem locally.  Just be real careful with ownership...

I've been tempted a time or two to see if I can get NXserver running on the core, but so far haven't tried...

HTH,
Roy

totallymaxed

  • LinuxMCE God
  • ****
  • Posts: 4660
  • Smart Home Consulting
    • View Profile
    • Dianemo - at home with technology
Re: How to use ssh to work on remote files on the core?
« Reply #2 on: February 16, 2008, 12:43:22 pm »
I want to start poking around a little bit. My core is stashed in a closet, so I need to edit files on another machine on the network. I just don't know how to do it...

So far I can
ssh linuxmce@192.168.80.1

and I'm at the terminal on the core. However, I don't know how to open those files on my local machine...
For example, if there is a file /temp.txt on the core, and I want to use gedit on my local machine to edit it.. I've tried:

sudo gedit /temp.txt

but I get an error that I have to specify a display.

What do I do? Am I going about this right?


Royw has already given you some good tips on how to do this... I would also suggest trying the following;

Once you've ssh'd into your core you can just edit and change files using console based tools. I like to use the text editor 'joe' but there are many other choices too... 'nano' is another nice editor (its installed by default). To edit a file you'd do something like below;

- login to your core as you already do over ssh
- install 'joe' if you'd like to try it by doing the following;

sudo apt-get update <return> (**this updates aptitudes database**)

then...

sudo apt-get install joe <return>

Thats it...done! Now you can try joe out.

- now you can use the 'cd' command to navigate to the directory where the files are that you want to create/edit or you can just provide the full path to them when starting the text editor up eg;

cd /home/temp <return> (**/home/temp is an example... you will not have that directory)

then do;

ls <return>

to see whats in /home/temp

to make a file called 'test' in /home/temp do the following;

sudo joe /home/temp/test <return>

Now your screen will display the empty file called 'test' opened in the 'joe' text editor. Type some text at the prompt and then save the file and exit joe by doing the following inside 'joe';

hold the Ctrl key down then press the 'K' key and then (still holding the Ctrl key down) press the 'X' key. That saves any changes to the file and exits joe. If you want to see some useful help about using joe's features you can display a panel at the top of the joe terminal window by typing Ctrl + K + H inside joe

To use the 'nano' editor do the following;

sudo nano /home/temp/test <return>

Type some text and then save it;

Hold Ctrl down and hit 'X' then hit 'Y' to save changes and then 'Return' to confirm the save... now your back at the console again.

All of the above has happened directly on your core without moving any files over the ssh session you kicked of at the beginning.

Hope the above helps.

Andrew



Andy Herron,
CHT Ltd

For Dianemo/LinuxMCE consulting advice;
@herron on Twitter, totallymaxed+inquiries@gmail.com via email or PM me here.

Get Dianemo-Rpi2 ARM Licenses http://forum.linuxmce.org/index.php?topic=14026.0

Get RaspSqueeze-CEC or Raspbmc-CEC for Dianemo/LinuxMCE: http://wp.me/P4KgIc-5P

Facebook: https://www.facebook.com/pages/Dianemo-Home-Automation/226019387454465

http://www.dianemo.co.uk

royw

  • Guru
  • ****
  • Posts: 261
    • View Profile
Re: How to use ssh to work on remote files on the core?
« Reply #3 on: February 16, 2008, 11:20:02 pm »
I just confirmed that Desktop Sharing (Krfb) is on LMCE.  Quick instructions for use:
* on MD, start KDE desktop
* Kmenu | Internet | Krfb - Desktop Sharing
* Create Personal Invitation
* On your workstation start VNC client (KMenu | Internet | Krdc - Remote Desktop Client
* Enter the password given on the Krfb screen

The advantage/disadvantage of Krfb is that it shares your MD's desktop session, including screen size (not very fun at NTSC-J :-)

One of the really nice features of nx is that you can specify the desktop size.

nxserver is not in LMCE's repository :-(

Here's some good instructions:  http://ubuntuforums.org/showthread.php?t=204976

I didn't follow these instructions for downloading the files, instead I browsed from my core to http://www.nomachine.com, then navigated to the NX Free Edition for Linux DEB - i386 (choose the x86_64 if your core is amd64) and downloaded instead of using the article's links.  Download all three (client, node, & server).

The instructions didn't give the exact commands to install the package with, here are some that worked for me:

linuxmce@dcerouter:~/Desktop$ sudo dpkg --install nxclient_3.1.0-6_i386.deb
linuxmce@dcerouter:~/Desktop$ sudo dpkg --install nxnode_3.1.0-6_i386.deb
linuxmce@dcerouter:~/Desktop$ sudo dpkg --install nxserver_3.1.0-5_i386.deb

Note, CUPS is not installed by default on the core so you can ignore those messages.

The rest of the instructions worked great.

You will also need to install the nxclient on your workstation.

HTH,
Roy