Fixing SamyGO telnet/SSH/SCP/bash on C/D/E/F series

Here are software that related with Samsung F series TVs.
Please don't create any new topic here unless you have software to post/release.
Post Reply

sectroyer
Official SamyGO Developer
Posts: 5765
Joined: Wed May 04, 2011 5:10 pm

Fixing SamyGO telnet/SSH/SCP/bash on C/D/E/F series

Post by sectroyer » Sun Mar 09, 2014 12:58 pm

THIS PART IS ONLY FOR C!!!!!!
FOR OTHER MODELS CHECK OTHER POSTS :)!!!!!!
I wanted to make as little changes to original SamyGO files as possible. Therefore (whenever it was possible) I have put most of my code in seperate files (rcEXT, rc.fix_telnetd, etc.). However probably it could be simplified and integrated directly with existing files (/dtv/.ashrc or /dtv/SGO.env). In order to make telnet working correctly (full bash history across reconnects and restarts, no more need to type . /dtv/SGO.env to have everything set up). You have to create following files:

$SYSROOT/rcEXT:

Code: Select all

#!/bin/sh

source /dtv/SGO.env

#echo "alias sgopwd='cd $1'" >> /dtv/SGO.env

echo "#!/dtv/network_opt/sh" > /dtv/sgoshfix
echo ". /dtv/SGO.env" >> /dtv/sgoshfix
echo "export HOME=\"$1\"" >> /dtv/sgoshfix
echo "export TERMINFO='$1/etc/terminfo'" >> /dtv/sgoshfix
echo "export TERM='xterm-color'" >> /dtv/sgoshfix
echo "export FRAMEBUFFER='/dev/sam/fb0'" >> /dtv/sgoshfix
echo "export LD_LIBRARY_PATH=\"$LD_LIBRARY_PATH\"" >> /dtv/sgoshfix
echo "export PATH=\"$PATH\"" >> /dtv/sgoshfix
echo "export SYSROOT=\"$SYSROOT\"" >> /dtv/sgoshfix
echo "export PS1='\u@tv:\w \\$ '" >> /dtv/sgoshfix

chmod +x /dtv/sgoshfix

ln -s "$SYSROOT/opt/privateer/usr/bin/" /dtv/bin

$1/etc/rc.fix_telnetd&
$SYSROOT/etc/rc.fix_telnetd:

Code: Select all

#!/bin/sh
killall telnetd
. /dtv/sgoshfix
cd
telnetd -l /dtv/network_opt/sh
In some cases you may have to run:

Code: Select all

chmod +x $SYSROOT/rcEXT
chmod +x $SYSROOT/etc/rc.fix_telnetd
Finally add to the end of $SYSROOT/rcSGO this single line:

Code: Select all

$1/rcEXT "$1"
After this you will have "fixed" telnet working. In order to "fix" SSH you just have to change the file $SYSROOT/etc/rc.sysinit. Locate the line:

Code: Select all

echo "export PS1='# '" >> /mtd_rwarea/profile
Comment it out and put bellow these lines:

Code: Select all

echo "PS1='\u@tv:\w \# '" >> /mtd_rwarea/profile
echo -e "ENV=/dtv/.ashrc\nexport ENV\n" >> /mtd_rwarea/profile
echo ". /dtv/sgoshfix" >> /mtd_rwarea/profile
 
mount -o bind /dtv/network_opt/sh /bin/sh 
Now both telnet and SSH have colors, full bash history across reconnects/reboots and always start a shell in $SYSROOT directory.

To get SCP working we just need to copy patched dropbear binary (attached in archive) to:

Code: Select all

$SYSROOT/opt/privateer/usr/sbin/dropbear
and scp static binary to:

Code: Select all

/opt/privateer/usr/bin/scp
You do not have the required permissions to view the files attached to this post.
I do NOT support "latest fw" at ALL. If you have one you should block updates on router and wait for it to STOP being "latest":)
If you want me to help you please paste FULL log(s) to "spoiler"/"code" bbcodes or provide link(s) to pasted file(s) on http://ctrlv.it/ Otherwise "NO HELP"!!!
If you want root DISABLE internet access to your device!!!!
DO NOT EVER INSTALL FIRMWARE UPGRADE !!!!

User avatar
juusso
SamyGO Moderator
Posts: 10125
Joined: Sun Mar 07, 2010 6:20 pm

Re: Fixing SamyGO telnet/SSH/SCP/bash on C series

Post by juusso » Mon Mar 10, 2014 4:01 pm

will check on D series (but need to adapt pathes first). Would be great to get reports from some other C series testers too.
LE40B653T5W,UE40D6750,UE65Q8C
Have questions? Read SamyGO Wiki, Search on forum first!
FFB (v0.8), FFB for CI+ . Get root on: C series, D series, E series, F series, H series. rooting K series, exeDSP/exeTV patches[C/D/E/F/H]

DO NOT EVER INSTALL FIRMWARE UPGRADE

sectroyer
Official SamyGO Developer
Posts: 5765
Joined: Wed May 04, 2011 5:10 pm

Re: Fixing SamyGO telnet/SSH/SCP/bash on C series

Post by sectroyer » Tue Mar 11, 2014 10:08 am

FOR E SERIES YOU HAVE TO DO THIS!!!!!!

You have to use dropbearmulti from archive attached in this post to get scp working for telnet and SSH it is enough to locate in /mnt/etc/rc.sysinit these lines:

Code: Select all

echo "export PS1='# '" >> /mtd_rwarea/profile
echo -e "ENV=/dtv/.ashrc\nexport ENV\n" >> /mtd_rwarea/profile
And change it to:

Code: Select all

echo "PS1='root@tv:\w \$ '" >> /mtd_rwarea/profile
echo -e "ENV=/dtv/.ashrc\nexport ENV\n" >> /mtd_rwarea/profile

ln -s /mnt/bin/ /dtv/bin
Than I have modified ./etc/init.d/01_01_catch_crap.init. I fixed the line with wrong path to mount.ko and added three more. Now it looks like this:

Code: Select all

    [ -e $MOD_DIR/kernel/drivers/pty/mount.ko ] && insmod $MOD_DIR/kernel/drivers/pty/mount.ko || echo "mount.ko not found."

    /bin/mount -o bind /mtd_rwarea/passwd /etc/passwd
    /bin/mount -o bind /mtd_rwarea/profile /etc/profile
    /bin/mount -o bind /mnt/bin/sh /bin/sh
Finally fix for telnetd (the same file) :

Code: Select all

    export HOME=/mnt/
    export PS1='root@tv:\w \$ '
    $SYSROOT/bin/busybox2 telnetd  -l /mnt/bin/sh
We need to change /bin/sh to /mnt/bin/sh (although at this moment it doesn't matter since we already mount-binded it ;)) and set up HOME and PS1 variables.

For scp we also needto change dropbearmulti to the one from the archive. Then we just make a symbolic link to dbclient:

Code: Select all

ln -s /mnt/opt/privateer/usr/sbin/dropbearmulti /mnt/bin/dbclient
ln -s /mnt/opt/privateer/usr/sbin/dropbearmulti /mnt/bin/scp
ln -s /mnt/opt/privateer/usr/sbin/dropbearmulti /mnt/opt/privateer/usr/sbin/dropbear
After this I have working bash history, telnet, ssh and scp :)

EDIT: Attached my /mnt/bin/busybox and dropbearmulti binaries.
bobiturboto wrote:FOR F SERIES YOU HAVE TO DO THIS!!!!!!

You have to use dropbearmulti from archive attached in this post to get scp working for telnet and SSH.

Upload and replace /mnt/opt/privateer/usr/sbin/dropbearmulti with the attached file.

Locate these lines in /mnt/etc/init.d/01_02_telnet.init :

Code: Select all

$SYSROOT/bin/busybox2 telnetd -p 23 -l $SYSROOT/bin/ash &  >> $LOGFILE 2>&1
Replace the line with this:

Code: Select all

	echo "export PS1='root@tv:\w \$ '" >> /mtd_rwarea/profile
	echo -e "ENV=/dtv/.ashrc\nexport ENV\n" >> /mtd_rwarea/profile
	echo "PS1='root@tv:\w \$ '" >> /mtd_rwarea/profile
	echo -e "ENV=/dtv/.ashrc\nexport ENV\n" >> /mtd_rwarea/profile
	/bin/mount -o bind "$SYSROOT/bin/sh" /bin/sh
	export HOME=/mnt/
	export PS1='root@tv:\w \$ '
	$SYSROOT/bin/busybox2 telnetd -p 23 -l $SYSROOT/bin/sh &  >> $LOGFILE 2>&1
In the same file find this part:

Code: Select all

        if [ ! -e /mtd_rwarea/passwd ]; then
                echo "root:saJvQKUdIxRW2:0:0:SamyGO secured Root:$NEW_HOME:$SYSROOT/bin/ash" > /mtd_rwarea/passwd
        fi
Replace it with this:

Code: Select all

	ln -s /mnt/bin/ /dtv/bin
		if [ ! -e /mtd_rwarea/passwd ]; then
                echo "root:saJvQKUdIxRW2:0:0:SamyGO secured Root:$HOME:/bin/sh" > /mtd_rwarea/passwd
        fi
Then run this commands:

Code: Select all

umount /mtd_rwarea/passwd
rm /mtd_rwarea/passwd
Execute the listed commands through telnet connection.

Code: Select all

chmod +x /mnt/opt/privateer/usr/sbin/dropbearmulti
rm /mnt/opt/privateer/usr/sbin/dropbear
ln -s /mnt/opt/privateer/usr/sbin/dropbearmulti /mnt/bin/dbclient
ln -s /mnt/opt/privateer/usr/sbin/dropbearmulti /mnt/bin/scp
ln -s /mnt/opt/privateer/usr/sbin/dropbearmulti /mnt/opt/privateer/usr/sbin/dropbear
Reboot your TV and after that you will have fixed telnet and working ssh access with scp and ssh history.
Default ssh user is root and the password is SamyGO

Credits to sectroyer.
You do not have the required permissions to view the files attached to this post.
I do NOT support "latest fw" at ALL. If you have one you should block updates on router and wait for it to STOP being "latest":)
If you want me to help you please paste FULL log(s) to "spoiler"/"code" bbcodes or provide link(s) to pasted file(s) on http://ctrlv.it/ Otherwise "NO HELP"!!!
If you want root DISABLE internet access to your device!!!!
DO NOT EVER INSTALL FIRMWARE UPGRADE !!!!

User avatar
juusso
SamyGO Moderator
Posts: 10125
Joined: Sun Mar 07, 2010 6:20 pm

Re: Fixing SamyGO telnet/SSH/SCP/bash on C/D/E/F series

Post by juusso » Tue Mar 11, 2014 10:08 am

after that fixes i could access tv via WinSCP :)
just keep in mind, SYSROOT on D series is ...

Code: Select all

echo $SYSROOT
/mtd_rwcommon/widgets/user/SamyGO/SamyGO
yeah, i know, better don`t mix testing different series in one topic, but i`m sure your fix will work on C/D/E/F (D/E/F are based on B/C Extensions scripts and changes were made just in matter of specific of each series).
LE40B653T5W,UE40D6750,UE65Q8C
Have questions? Read SamyGO Wiki, Search on forum first!
FFB (v0.8), FFB for CI+ . Get root on: C series, D series, E series, F series, H series. rooting K series, exeDSP/exeTV patches[C/D/E/F/H]

DO NOT EVER INSTALL FIRMWARE UPGRADE

sectroyer
Official SamyGO Developer
Posts: 5765
Joined: Wed May 04, 2011 5:10 pm

Re: Fixing SamyGO telnet/SSH/SCP/bash on C/D/E/F series

Post by sectroyer » Tue Mar 11, 2014 10:58 am

juuso wrote:after that fixes i could access tv via WinSCP :)
just keep in mind, SYSROOT on D series is ...

Code: Select all

echo $SYSROOT
/mtd_rwcommon/widgets/user/SamyGO/SamyGO
yeah, i know, better don`t mix testing different series in one topic, but i`m sure your fix will work on C/D/E/F (D/E/F are based on B/C Extensions scripts and changes were made just in matter of specific of each series).
If you got it working on D then we have all (besides F which probably is the same as E) series working :) Denny already uploaded my patch to C http://download.samygo.tv/C%20Series/Fo ... sh_mod.tgz. ATM I think it's better to prepare fixes (with defails of all changes) to every series separety. The patch are different ETC. Also do you have bash history (across reconnects/restarts) and color in both telnet and SSH ?:)
I do NOT support "latest fw" at ALL. If you have one you should block updates on router and wait for it to STOP being "latest":)
If you want me to help you please paste FULL log(s) to "spoiler"/"code" bbcodes or provide link(s) to pasted file(s) on http://ctrlv.it/ Otherwise "NO HELP"!!!
If you want root DISABLE internet access to your device!!!!
DO NOT EVER INSTALL FIRMWARE UPGRADE !!!!

User avatar
juusso
SamyGO Moderator
Posts: 10125
Joined: Sun Mar 07, 2010 6:20 pm

Re: Fixing SamyGO telnet/SSH/SCP/bash on C/D/E/F series

Post by juusso » Tue Mar 11, 2014 5:22 pm

yes, i saw these files on server, they slightly differ from files you`ve attached here ;)

I haven`t succeed to merge your full patch with my Extensions, somewhere i still make mistakes. As result - still no benefits you mentioned. Yet.

We could merge all for each series, so no need to distribute separate fixes. Just re-install whole widget.
LE40B653T5W,UE40D6750,UE65Q8C
Have questions? Read SamyGO Wiki, Search on forum first!
FFB (v0.8), FFB for CI+ . Get root on: C series, D series, E series, F series, H series. rooting K series, exeDSP/exeTV patches[C/D/E/F/H]

DO NOT EVER INSTALL FIRMWARE UPGRADE

sectroyer
Official SamyGO Developer
Posts: 5765
Joined: Wed May 04, 2011 5:10 pm

Re: Fixing SamyGO telnet/SSH/SCP/bash on C/D/E/F series

Post by sectroyer » Tue Mar 11, 2014 5:37 pm

juuso wrote:yes, i saw these files on server, they slightly differ from files you`ve attached here ;)

I haven`t succeed to merge your full patch with my Extensions, somewhere i still make mistakes. As result - still no benefits you mentioned. Yet.

We could merge all for each series, so no need to distribute separate fixes. Just re-install whole widget.
I don't like reinstalling everything ;) Anyway I don't know much about D series Extension but it shouldn't be much different. Since you already have SCP working than now it should just be a matter of launching telnet with different "sh". I have unpacked the D Extensions from the website so they probably differ a little but it looks that you have busybox in /SamyGO/bin/busybox so just make a smiling to it in /SamyGO/bin/sh, then relaunch telnetd with this shell :)
I do NOT support "latest fw" at ALL. If you have one you should block updates on router and wait for it to STOP being "latest":)
If you want me to help you please paste FULL log(s) to "spoiler"/"code" bbcodes or provide link(s) to pasted file(s) on http://ctrlv.it/ Otherwise "NO HELP"!!!
If you want root DISABLE internet access to your device!!!!
DO NOT EVER INSTALL FIRMWARE UPGRADE !!!!

sectroyer
Official SamyGO Developer
Posts: 5765
Joined: Wed May 04, 2011 5:10 pm

Re: Fixing SamyGO telnet/SSH/SCP/bash on C/D/E/F series

Post by sectroyer » Sat Mar 15, 2014 3:09 pm

How is the progress ? :) When D becomes stable I think it's good point to release full C/D/E support. C/E is very stable ATM :)
I do NOT support "latest fw" at ALL. If you have one you should block updates on router and wait for it to STOP being "latest":)
If you want me to help you please paste FULL log(s) to "spoiler"/"code" bbcodes or provide link(s) to pasted file(s) on http://ctrlv.it/ Otherwise "NO HELP"!!!
If you want root DISABLE internet access to your device!!!!
DO NOT EVER INSTALL FIRMWARE UPGRADE !!!!

zoelechat
Official SamyGO Developer
Posts: 8372
Joined: Fri Apr 12, 2013 7:32 pm
Location: France

Re: Fixing SamyGO telnet/SSH/SCP/bash on C/D/E/F series

Post by zoelechat » Mon Mar 17, 2014 5:44 pm

I've done every step and everything works as expected (colors, SCP...)
Just had a strange problem: rcEXT couldn't be executed, neither by rcSGO nor manually (of course it was present and chmodded +x :) )

Code: Select all

root@tv:/mnt # ./rcEXT
/mnt/bin/sh: ./rcEXT: not found
So /dtv/sgoshfix was never created and ssh gave an error on open because it was unable to find the file.
I've just included rcEXT code at the end of rcSGO and the problem is gone...

I also need to launch dropbear manually to have ssh/SCP/port 22 opened, where should I include it to be safely executed? Somewhere in catch_crap.init I presume?
I do NOT receive any PM. Please use forum.

sectroyer
Official SamyGO Developer
Posts: 5765
Joined: Wed May 04, 2011 5:10 pm

Re: Fixing SamyGO telnet/SSH/SCP/bash on C/D/E/F series

Post by sectroyer » Mon Mar 17, 2014 5:46 pm

zoelechat wrote:I've done every step and everything works as expected (colors, SCP...)
Just had a strange problem: rcEXT couldn't be executed, neither by rcSGO nor manually (of course it was present and chmodded +x :) )

Code: Select all

root@tv:/mnt # ./rcEXT
/mnt/bin/sh: ./rcEXT: not found
So /dtv/sgoshfix was never created and ssh gave an error on open because it was unable to find the file.
I've just included rcEXT code at the end of rcSGO and the problem is gone...

I also need to launch dropbear manually to have ssh/SCP/port 22 opened, where should I include it to be safely executed? Somewhere in catch_crap.init I presume?
On which TV model were you testing it?
I do NOT support "latest fw" at ALL. If you have one you should block updates on router and wait for it to STOP being "latest":)
If you want me to help you please paste FULL log(s) to "spoiler"/"code" bbcodes or provide link(s) to pasted file(s) on http://ctrlv.it/ Otherwise "NO HELP"!!!
If you want root DISABLE internet access to your device!!!!
DO NOT EVER INSTALL FIRMWARE UPGRADE !!!!

Post Reply

Return to “[F] Software”