Announcement

Collapse
No announcement yet.

Newbie with HT-PI-G2 need help editing a file in Linux

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • kenm
    replied
    A word of caution: The 'root' user, as well as the 'su' and 'sudo' commands should be used with extreme care, particularly by novice users. IMHO, the root user should not even be allowed to ssh into the unit and /usr/local/HomeSeer should be owned by a user other than root. There are ways of allowing a normal user access to system resources, like serial port, etc, without running as root.

    Leave a comment:


  • skozin
    replied
    Thanks. Once I was able to change the root password I was able to get into the device and then use winscp to copy and transfer all the files I needed to. I would never have learned any of this without you guys on this forum.

    Leave a comment:


  • kenm
    replied
    I don't use WinSCP but here's how to do it with scp (Secure Copy):

    Open a Command window and type:

    cd \Users\Steve\Desktop\HomeSeer HS4\html

    scp file_to_copy root@ip_of_HT-PI-G2:/usr/local/HomeSeer/html/.

    The ":" after the IP and the "/." at the end of the target are important.
    Last edited by kenm; March 13, 2022, 11:20 AM. Reason: Changed user from 'pi' to 'root' for scp command since root owns /usr/local/HomeSeer.

    Leave a comment:


  • skozin
    replied
    So say I want to copy a file from windows over to my Linux HT-Pi-G2. (The file is Here: C:\Users\Steve\Desktop\HomeSeer HS4\html) The file is over on my Windows 10 machine. I have tried using WinSCP and get an error Permission Denied. I am new to Linux. Can someone explain to me how to do this?

    Pete showed me this to edit a file and that worked. I don't understand how to copy a file from Windows 10 into Linux:

    Via command line:

    1 - ssh to IP of HT-PI-G2
    2 - type sudo su
    3 - password
    4 - cd /usr/local/HomeSeer/html * copy and paste is easiest
    5 - ls
    6 - nano edit file in question.

    I want to copy the file to line 4: cd /usr/local/HomeSeer/html * copy and paste is easiest

    What does he mean by *copy and paste is easiest. (what would be the code for that?)

    Thanks in advance.

    Steve

    Leave a comment:


  • kenm
    replied
    Originally posted by concordseer View Post

    Do bear in mind once you use sudo su you have root access to your system so you won’t receive any warning when you are making changes to files. Care must be exercised at all times.
    I agree. I recommend skipping steps 2 and 3 and adding a 'sudo' in front of the nano command in step 6 so you only run that command with root access.

    Leave a comment:


  • concordseer
    replied
    Originally posted by skozin View Post
    I was able to use Pete's response to get in:

    Via command line:

    1 - ssh to IP of HT-PI-G2
    2 - type sudo su
    3 - password
    4 - cd /usr/local/HomeSeer/Data/Tuya * copy and paste is easiest
    5 - ls
    6 - nano edit file in question.

    Thanks again for all the help.
    Do bear in mind once you use sudo su you have root access to your system so you won’t receive any warning when you are making changes to files. Care must be exercised at all times.

    Leave a comment:


  • skozin
    replied
    I was able to use Pete's response to get in:

    Via command line:

    1 - ssh to IP of HT-PI-G2
    2 - type sudo su
    3 - password
    4 - cd /usr/local/HomeSeer/Data/Tuya * copy and paste is easiest
    5 - ls
    6 - nano edit file in question.

    Thanks again for all the help.

    Leave a comment:


  • NutsyHome
    replied
    Originally posted by skozin View Post
    When I try this (sudo vi LocalApiProducts.json) it just shows new file. I am stumped.
    After you cd into the directory, use the ls command to see what's actually there, and verify the actual file name.

    Leave a comment:


  • skozin
    replied
    Guess what, I figured it out with Pete's command line instructions. It took a little bit to edit but it is done. Thanks all.

    Regards,
    Steve

    Leave a comment:


  • skozin
    replied
    There is no SCP Shell and no sudo -s. I have under environment>shell> I can change the shell to sudo su- and when I do I still get the permission error.

    Leave a comment:


  • rmasonjr
    replied
    Try this from the winscp site:
    In WinSCP from the launch window select your connection then Edit>Advanced>SCP Shell>and change it to sudo -s then save.

    Leave a comment:


  • skozin
    replied
    From rmasonjr: Just use WinSCP. It has a windows style interface and you can edit files.

    Well I tried all your suggestions and I get the same results, Permission denied. I tried WinSCP and that was so simple but it says permission denied. What am I doing wrong?

    Originally posted by NutsyHome View Post

    Also, depending on how you're remoting into the Pi, you may need to force a different username. I typically use ssh -l homeseer 172.24.1.xxx (insert the Pi's address on your network). Finally, you may need to put sudo in front of your editor command, to gain root user privileges. (sudo vi LocalApiProducts.json).
    When I try this (sudo vi LocalApiProducts.json) it just shows new file. I am stumped.

    Leave a comment:


  • rmasonjr
    replied
    Just use WinSCP. It has a windows style interface and you can edit files.

    Leave a comment:


  • Pete
    replied
    Here utilize SFTP file explorer in Ubuntu Linux desktop to edit files. Via command line utilize nano and sudo before editing a file.

    Via command line:

    1 - ssh to IP of HT-PI-G2
    2 - type sudo su
    3 - password
    4 - cd /usr/local/HomeSeer/Data/Tuya * copy and paste is easiest
    5 - ls
    6 - nano edit file in question.

    Via Linux file explorer gui

    1 - sftp://ip_HT_PI-G2
    2 - first time login typically for me is just to utilize root
    3 - go to directory in question and highlight file to edit and edit it

    Leave a comment:


  • NutsyHome
    replied
    Originally posted by skozin View Post
    I have the HT-PI-G2 and it is working fine. I am using the Tuya plugin in which one of the files (LocalApiProducts.json) which is located in /USR/Local/Homeseer/Data/Tuya/ directory. I need to edit that file and I try to use Firezilla in which I see the file but can't edit it (It says permission denied). I tried using Putty but have no idea how to get to that directory and edit it. Can it be done and if so how? A quick lessen from one of you masters would be great!

    Thanks in advance.
    Reminder that Linux commands and folder/file names are case sensitive. The folder name is likely /usr/local/HomeSeer/Data/Tuya

    Also, depending on how you're remoting into the Pi, you may need to force a different username. I typically use ssh -l homeseer 172.24.1.xxx (insert the Pi's address on your network). Finally, you may need to put sudo in front of your editor command, to gain root user privileges. (sudo vi LocalApiProducts.json).

    Leave a comment:

Working...
X