0

I'm thinking about this problem, I know the way I'd like to proceed, but I do not know yet how to implement it (and when I say "how" I mean that theoretically I don't know if I should use TFTP, FTP or other methods, not that I need the code..otherwise there will be no fun for me!! ahah).

I would like to write an application (c, c++ or c#) that is able to connect from a Windows PC to a Linux board to modify files. What I actually do (manually) is:

  • serial connection to the board;
  • open the Linux console;
  • login as root;
  • change directories until I find the configuration file that I want to change;
  • open the file with VI and edit it;
  • reboot from Linux console.

Do you think there is a way to do this automatically? I mean, login as root, copy the target file on the pc, and then upload to the board the modified file? I'm asking this, because I don't want to take the risk of accidentally change something wrong.

Thanks all, electroDi

electroDi
  • 1
  • 2
  • The actual answer to your question really depends on what kind of edits you do to the files, what kind of connection(s) you have available, as well as probably half a dozen other factors. Can you describe what your overall goal is? [I work on "linux boards" all the time at work, and although I use Linux to access those boards, I don't think that matters as much as for example what interconnect there is between your PC and target]. – Mats Petersson Feb 15 '14 at 16:12
  • I would like to change the configuration files in the etc folder, for example change the static IP in etc/network/interfaces. I usually open a console with an SSH client, the physical connection could be serial or via LAN. The goal is to avoid me (or any other possible user) to change other files for mistake. – electroDi Feb 15 '14 at 16:23
  • So, you can either keep a copy of the file locally (or copy it to the local machine), write some code that make the relevant edits to the copy of the file, and then copy it back. If you have network access, then use `scp` (ssh protocol for remote file copy). – Mats Petersson Feb 15 '14 at 16:55
  • Install Linux on your laptop PC. Then use `scp` or `ssh` – Basile Starynkevitch Feb 15 '14 at 16:58
  • As usual, Basile offers a practical answer. I second his answer. However, if the client machine must run windows, and your goal is to automate the file copy, you may want to take a look at Chilkatsoft's SSH / SFTP ActiveX control (at http://www.chilkatsoft.com/ssh-sftp-activex.asp). You can use this control with C#, Powershell, VB.net, ASP.net, etc., to program file copies to a remote host, such as your Linux board. – mti2935 Feb 15 '14 at 17:26
  • Thanks a lot, I will try both the solutions! – electroDi Feb 16 '14 at 02:34
  • And in case you have no network connection to the development board, use PPP over serial link. –  Feb 16 '14 at 12:21

0 Answers0