~/guides/ssh-into-lg-tv
$ cat guides/ssh-into-lg-tv.md

SSH into a rooted LG TV.

How to turn SSH on, log in as root, switch to a key, copy files, and get back in when it breaks.

1. Turn SSH on

You need a rooted TV with the Homebrew Channel. Open it, select the gear icon, turn on SSH Server, and restart the TV. While you're there, keeping Telnet on too gives you a way back in if SSH ever breaks.

2. Log in

Find the TV's IP address in its network settings, then from a computer on the same network:

$ ssh root@192.168.1.50

The webOS SSH default password: user root, port 22, password alpine. On Windows, the built-in ssh in PowerShell or Windows Terminal works the same, or use PuTTY.

3. Switch to a key

Keys go in /home/root/.ssh/authorized_keys, one per line. The first key you add turns password login off at the next boot, so check the key works before you restart. The common ways this goes wrong: Windows line endings in the file, a key wrapped across lines, a private key pasted instead of the .pub half, or the wrong owner or permissions.

SSH Doctor skips all of that: on the TV, choose Set up a key, scan the QR code or open the address on your computer or phone, enter the short pairing code, and upload a key or let the browser make one. It also gives you a ready-made ~/.ssh/config entry, so ssh lgtv just works.

Developer Mode SSH is different

LG's Developer Mode runs its own SSH server on port 9922, as user prisoner, with a key and passphrase the Developer Mode app gives you. It's meant for LG's developer tools (ares and webOS Dev Manager), it isn't root, and it can't change the system. Everything else on this page is the Homebrew Channel's root SSH on a rooted TV.

4. Copy files

SFTP uses the same login. WinSCP, FileZilla and Cyberduck work with the Homebrew Channel's sftp-server, or from a terminal:

$ scp movie.mkv root@192.168.1.50:/media/internal/

When it breaks

errorwhat it usually means
Connection refusedSSH is off, didn't start, or something else took port 22.
Permission denied (publickey)A key was added, so alpine is off, and the key doesn't match or the keys file is broken.
No supported authentication methods available (PuTTY)The same, seen from PuTTY.
REMOTE HOST IDENTIFICATION HAS CHANGEDThe TV's host key changed, usually after a reset. Check its fingerprint, then remove the old line from known_hosts.
no matching host key type foundA newer SSH client refusing the TV's older key type.

None of these needs a factory reset. SSH Doctor runs through the Homebrew Channel rather than over SSH, so it works even when SSH is completely broken: it shows which of these it is, in plain words, and fixes it with one button, with a backup and an undo.

Related

FAQ

What's the default SSH login for a rooted LG TV?
User root, port 22, password alpine, once SSH is turned on in the Homebrew Channel. Adding your first key turns the alpine password off at the next boot.
Why does SSH say Connection refused?
The SSH server isn't running or listening on that port. Turn on SSH in the Homebrew Channel's settings and restart the TV, or use SSH Doctor's Turn SSH on now, which starts it without a restart.
I added a key and now the password doesn't work.
That's by design: the first key in authorized_keys turns alpine off at the next boot. If the key itself doesn't work, often because of Windows line endings or a key pasted on several lines, SSH Doctor's Fix my keys file or Go back to password login gets you back in.
Is Developer Mode SSH the same thing?
No. Developer Mode runs its own SSH on port 9922, for LG's developer tools, with a key and passphrase from the Developer Mode app. The Homebrew Channel's SSH is root on port 22.
How do I copy files to the TV?
Over SFTP. WinSCP, FileZilla and Cyberduck work with the Homebrew Channel's sftp-server, using the same login as SSH.