DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

#1 2006-09-04 11:30:47

sala
Member / Site Admin
From: Estonia
Registered: 2006-07-28
Posts: 731
Website

How to fun_plug

Background info.

On startup DSM-G600 will run /etc/rc.sh which will mount the various filesystems and initialize the drive.

Code:

...
touch /tmp/boot_finished
/usr/sbin/chk_fun_plug &

/usr/sbin/chk_fun_plug will check for file called fun_plug on the disks root and then executes it.

Code:

#!/bin/sh

sleep 30

Dir_Len=28
Filename_Len=26
CUSTOMIZEHDPATH=/sys/custom/shared_name/HD

file=$(find "$CUSTOMIZEHDPATH"/*)
HD_Path=`expr substr "$file" "$Dir_Len" "$Filename_Len"`
HD_Path=$HD_Path"a2"

if [ -e /mnt/$HD_Path/fun_plug ]; then
        echo "function plug enable"
        /mnt/$HD_Path/fun_plug
fi

Using fun_plug.

*Install new unformatted hard drive to your DSM-G600.
*Boot-up.
*Go into http://<insert dsm-g600 ip here>/
*Press format.
*When finished, shutdown DSM-G600.
*Take hard disk out of DSM-G600 and mount it into your (nix based, ext3 supported) computer.
*Execute these commands.

Code:

touch /mnt/<insert dsm-g600 disk mount point here>/fun_plug
chmod 777 /mnt/<insert dsm-g600 disk mount point here>/fun_plug

*Edit /mnt/<insert dsm-g600 disk mount point here>/fun_plug with your favorite text editor. For example, you can test fun_plug with following lines.

Code:

#!/bin/sh
dmesg > /mnt/HD_a2/dmesg.out

*Put hard disk back to your DSM-G600.

PS: I have heard that chmoding fun_plug to executable over ftp will also work. But method described here is foolproof smile


DSM-G600 - NetBSD hdd-boot - 80GB Samsung SP0802N
NSA-220 - Gentoo armv5tel 20110121 hdd-boot - 2x 2TB WD WD20EADS

Offline

 

#2 2006-09-04 23:16:32

qn1234
Member
Registered: 2006-08-18
Posts: 94

Re: How to fun_plug

I edit fun_plug from Windows using vim and seems to work fine.  I have Cygwin (www.cygwin.org) installed so chmod is available.

* Format the drive by clicking on the Format button
* Create a share point
* From Windows, type: net use G: \\192.168.0.1\HDD_a /user:admin
   Then enter the password
* Edit fun_plug using: vim G:\fun_plug
* Don't forget to make the file UNIX format by typing: :set fileformat=unix
* Using chmod that comes with Cygwin: cd G:; chmod +x fun_plug
* From web interface, reboot DSM-G600

--
Quang

Offline

 

#3 2006-09-28 00:40:47

joecrow
Member
Registered: 2006-09-28
Posts: 5

Re: How to fun_plug

I am confirming that it's possible to edit the fun_plug from Mac OS X using vim (or any other editor i expect), as well.  The steps are similar to above:

* After formatting, mount as a SMB share (In the "Connect To..." Finder window enter "smb://192.168...")
* Edit the fun_plug
* chmod 777 fun_plug
* reboot the routr

The biggest gotcha I had was determining that the hard drive was being mounted as HD_a2.  I was trying to redirect to HDD_a because that is the name of my hard drive through the web interface and the name of the smb mount

Thanks for the tutorial - sala and quang.

- Joe

Offline

 

#4 2006-10-05 23:39:36

Grouper
Member
Registered: 2006-09-19
Posts: 33

Re: How to fun_plug

qn1234 wrote:

I edit fun_plug from Windows using vim and seems to work fine.  I have Cygwin (www.cygwin.org) installed so chmod is available.

* Format the drive by clicking on the Format button
* Create a share point
* From Windows, type: net use G: \\192.168.0.1\HDD_a /user:admin
   Then enter the password
....

--
Quang

Thanks Quanq, I tried this, but I cannot log me in with the password I use to configure the Web Front-End. I also tried to smb-connect with admin as user, after I tried my pw once i got 192.168.0.1\guest as login possibility.

What did i do wrong?

And by the way, can someone please post a step by step fun_plug possibility of ushare?
Thanks a lot in advance guys,you are doing a great job

Offline

 

#5 2006-10-06 11:39:13

sala
Member / Site Admin
From: Estonia
Registered: 2006-07-28
Posts: 731
Website

Re: How to fun_plug

Whats "my password"? Try not add any passwords to your share and try again.


DSM-G600 - NetBSD hdd-boot - 80GB Samsung SP0802N
NSA-220 - Gentoo armv5tel 20110121 hdd-boot - 2x 2TB WD WD20EADS

Offline

 

#6 2006-10-06 14:16:16

Grouper
Member
Registered: 2006-09-19
Posts: 33

Re: How to fun_plug

Ok, without a user in the share, and without a password it worked. Thanks!

Offline

 

#7 2006-11-10 13:31:13

eko
Member
Registered: 2006-11-08
Posts: 9

Re: How to fun_plug

Hiya fellow NAS modders,

I'm waiting for my DNS-323 to arrive, just ordered it. I can imagine the possibililties, as it's based on GPL and can host a large set of files. I guess the tricky part is to recompile the firmware, to allow new services such as SSH, TELNET, IPSEC (would be great to secure file transfers from remote sites) and a second WEBSERVER. A bittorrent client would be awesome. Another thing i'm curious about is to add ports (maybe PATA) and futher RAID configurations (RAID5 and above).

Props to the people who opened this site !!
I'll keep an eye on the forum and share my experiences and mods with you.

/eko

Offline

 

#8 2006-11-10 13:42:59

sala
Member / Site Admin
From: Estonia
Registered: 2006-07-28
Posts: 731
Website

Re: How to fun_plug

eko wrote:

Hiya fellow NAS modders,

I'm waiting for my DNS-323 to arrive, just ordered it. I can imagine the possibililties, as it's based on GPL and can host a large set of files. I guess the tricky part is to recompile the firmware, to allow new services such as SSH, TELNET, IPSEC (would be great to secure file transfers from remote sites) and a second WEBSERVER. A bittorrent client would be awesome. Another thing i'm curious about is to add ports (maybe PATA) and futher RAID configurations (RAID5 and above).

Props to the people who opened this site !!
I'll keep an eye on the forum and share my experiences and mods with you.

/eko

You're welcome smile
We have also separate forum section for DNS-323!
http://forum.dsmg600.info/f3-General-Discussion.html


DSM-G600 - NetBSD hdd-boot - 80GB Samsung SP0802N
NSA-220 - Gentoo armv5tel 20110121 hdd-boot - 2x 2TB WD WD20EADS

Offline

 

#9 2006-11-13 10:36:17

sala
Member / Site Admin
From: Estonia
Registered: 2006-07-28
Posts: 731
Website

Re: How to fun_plug

I did add a wiki article about fun plugging. If you see some nonsense or you like to add something then please do it! smile
http://dsmg600.info/howto:fun_plug


DSM-G600 - NetBSD hdd-boot - 80GB Samsung SP0802N
NSA-220 - Gentoo armv5tel 20110121 hdd-boot - 2x 2TB WD WD20EADS

Offline

 

#10 2007-03-31 15:29:54

Tapsa
New member
Registered: 2007-03-31
Posts: 1

Re: How to fun_plug

Hi,

As a complete novice, I tried to follow your wiki-instructions for fun_plug.
It seemed simple.

I created a fun_plug file copy-pasting the two lines as in your example:

#!/bin/sh
dmesg > /mnt/HD_a2/dmesg.out

I copied that to /HD_a2 using WS_FTP
I changed the rights of fun_plug to 777 using WS_FTP
I can check the rights of /HD_a2/fun_plug really are 777
From web front-end I rebooted the system
Result: nothing. No file "dmesg.out" at /HD_a2.

What have I done wrong here?

My firmware version is 1.02eu

Thank you very much in advance!!

Offline

 

#11 2007-03-31 23:31:53

sala
Member / Site Admin
From: Estonia
Registered: 2006-07-28
Posts: 731
Website

Re: How to fun_plug

Common mistake is that people think HD_a2 is a directory that you can create. But it is not, it is mount point and you don't see it from ftp. You can see real HD_a2 only from shell using telnet.
Long story short - fun_plug must be placed at the root of your hard disk.


DSM-G600 - NetBSD hdd-boot - 80GB Samsung SP0802N
NSA-220 - Gentoo armv5tel 20110121 hdd-boot - 2x 2TB WD WD20EADS

Offline

 

#12 2007-06-02 05:32:23

lhg
New member
Registered: 2007-06-02
Posts: 3

Re: How to fun_plug

sala wrote:

Long story short - fun_plug must be placed at the root of your hard disk.

I am running firmware 1.02 us. after carefully following the steps in the wiki how to page, fun_plug did not work for me.
Did google and found a post mentioned problem with firmware 1.02 http://forum.openwrt.org/viewtopic.php?pid=32760 second post in the page.
Does it mean fun_plug is no longer working in the new firmware?


Thanks

Offline

 

#13 2007-06-02 10:26:43

BertrandB
Member
From: Dijon (France)
Registered: 2006-09-16
Posts: 119
Website

Re: How to fun_plug

lhg wrote:

Does it mean fun_plug is no longer working in the new firmware?

No it means you made an error ...
is fun_plug under /mnt/HD_a2/ ? (the root of share when you get the dsm out of the box)
is fun_plug with execute rights ?
is fun_plug valide script ?
did you get all the needed exec from the download section ? (for exemple for telnet you need busybox and sed)
have the execs the execute rights ?
did you mke a typo somewhere like Fun-Plug ?

Offline

 

#14 2007-06-03 16:20:17

lhg
New member
Registered: 2007-06-02
Posts: 3

Re: How to fun_plug

BertrandB wrote:

No it means you made an error ...

There was no error, I just used the test script.
#!/bin/sh
dmesg > /mnt/HD_a2/dmesg.out
Left the unit overnight an it worked without any change, which is strange. Thanks anyway

Offline

 

#15 2007-06-03 22:07:17

BertrandB
Member
From: Dijon (France)
Registered: 2006-09-16
Posts: 119
Website

Re: How to fun_plug

This not at all strange dmesg read the log and stop at the end of file .... so you can let your dsm all long time you want the dmesg is dead and the log don't change.

Offline

 

#16 2007-07-18 00:21:37

Abrink
New member
Registered: 2007-07-18
Posts: 1

Re: How to fun_plug

Hi all!
After several hours of pulling my hair I finally figured it out and thought I'd post a little tip.
Create the fun_plug file using UltraEdit and save it directly to the DSM-G600 using the "File | FTP/Telnet | Save as to ftp..." option, permissions can be set here aswell.
Works like a charm. Telnet is up aswell thanks to UltraEdit.
The Permissions won't stick using a ordinary ftp client.


Thanks and good luck.

Offline

 

#17 2007-08-21 10:01:17

mppkll
Member
Registered: 2007-08-21
Posts: 7

Re: How to fun_plug

First: The Wiki article was very helpful Thank you!

Next: To get the chmod command to work while using windows ftp you need to use the literal command.  The literal command sends the command directly to the remote server without validating it first, this is needed because Windows FTP does not support chmod.   So the command from Windows FTP is "literal site chmod 777 fun_plug".  I changed the Wiki site to reflect this.

Thanks again for the info on fun_plug

-Mike

Last edited by mppkll (2007-08-21 10:04:08)

Offline

 

#18 2009-07-15 04:56:11

Perta
New member
Registered: 2009-07-15
Posts: 2

Re: How to fun_plug

Hello. I ve spent some time trying to fun_plug, with no success. Now I m stuck, so I ll try to ask here. Maybe somebody will help me out.

So, I m quite bad at soldering, so my goal is to leave kernel (firmware for that matter) untouched, and get a linux distro (gentoo or debian, doesnt matter) thru fun_plug and chroot. But for now I cannot fun_plug or, for that matter, telnet.

I got G600 with no ide HDD inside, and attached external usb 2.0 WD HDD of 1Tb.

I have created the file fun_plug in the root of the HDD.

Code:

c:\>ftp 192.168.1.18
Connected to 192.168.1.18.
220 korobochka1 FTP server (Version wu-2.6.2(48) Mon Aug 21 14:08:09 CST 2006)
User (192.168.1.18:(none)): anonymous
331 Guest login ok, send your complete e-mail address as password.
Password:
230 Guest login ok, access restrictions apply.
ftp> ls
200 PORT command successful.
150 Opening ASCII mode data connection for directory listing.
total 1792
drwxrwxrwx   3 root root    32768 Jul 14 17:36 .
drwxrwxrwx   3 root root    32768 Jul 14 17:36 ..
-rwxrwxrwx   1 root root      804 Jul 13 21:42 .ftpaccess
-rwxrwxrwx   1 root root       21 Jul 14 17:36 .ftpshare
-rwxrwxrwx   1 root root      107 Jul 14 17:36 .smb.ses
-rwxrwxrwx   1 root root   515228 Aug 18  2006 busybox
-rwxrwxrwx   1 root root      127 Jul 14 17:33 fun_plug
-rwxrwxrwx   1 root root   133630 Oct 13  2006 sed
drwxrwxrwx   4 root root    32768 Jul 13 22:52 video
226 Transfer complete.
ftp> pwd
257 "/" is current directory.

the contents of fun_plug is:

Code:

#!/bin/sh
touch /mnt/HD_a1/a1.txt
touch /mnt/HD_a2/a2.txt
touch /mnt/HD_a3/a3.txt
touch /mnt/HD_a4/a4.txt
dmesg > ./dmesg.txt

or in hex, so that you can see LF is UNIX style:

Code:

0000000000: 23 21 2F 62 69 6E 2F 73 │ 68 0A 74 6F 75 63 68 20  #!/bin/sh◙touch
0000000010: 2F 6D 6E 74 2F 48 44 5F │ 61 31 2F 61 31 2E 74 78  /mnt/HD_a1/a1.tx
0000000020: 74 0A 74 6F 75 63 68 20 │ 2F 6D 6E 74 2F 48 44 5F  t◙touch /mnt/HD_
0000000030: 61 32 2F 61 32 2E 74 78 │ 74 0A 74 6F 75 63 68 20  a2/a2.txt◙touch
0000000040: 2F 6D 6E 74 2F 48 44 5F │ 61 33 2F 61 33 2E 74 78  /mnt/HD_a3/a3.tx
0000000050: 74 0A 74 6F 75 63 68 20 │ 2F 6D 6E 74 2F 48 44 5F  t◙touch /mnt/HD_
0000000060: 61 34 2F 61 34 2E 74 78 │ 74 0A 64 6D 65 73 67 20  a4/a4.txt◙dmesg
0000000070: 3E 20 2E 2F 64 6D 65 73 │ 67 2E 74 78 74           > ./dmesg.txt

on reboot none of the files appear.

Question: What am I missing? How do i fun_plug?

btw, what is the easiest and most straight forward way to have torrent client on the box? I ve read most of the treads on this forum and it is not clear which is the best way to go.

Offline

 

#19 2009-07-21 05:34:58

Perta
New member
Registered: 2009-07-15
Posts: 2

Re: How to fun_plug

Ok, i got it working after installing an internal HDD. It was not said anywhere in howto that you do need to fun_plug from internal HDD only. So beware.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB