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.

Announcement

#1 2008-04-17 10:48:23

kenyloveg
Member
Registered: 2008-04-10
Posts: 41

How to run the shell after connect with Putty through OpenSSH

My DNS 323 is running fun plug 0.5 now and 1.04 firmware.

The problem is when I use telnet, I can't access Transmission by Clutch if i did not use "export" to set "Transmission home". But it need me to run export everytime when i reboot DNS 323.
Fonz said I need to connect through SSH to have a profile which can save enviroment settings like export Transmission Home.
I can connect through SSH by using Putty now, but everytime i need to input 5784468 to get a shell prompt. And I noticed it' built in Busybox, not Fonz's new busybox in fun plug 0.5.
Is there anyway to get into Fon'z busybox directly after everytime reboot?
Once i set "export TRANSMISSION_HOME=mnt/HD_a2/downloads/.transmission", it will be saved to where? To funplug_script, to /etc/ssh/sshd_config or to etc/profile/?

Thanks for your help.

Offline

 

#2 2008-04-17 21:09:13

skel
Member
Registered: 2008-04-17
Posts: 6

Re: How to run the shell after connect with Putty through OpenSSH

First post in this forum. Good work fonz, and everyone else who has helped blaze a trail for us in hacking the DNS 323.

I recently upgraded to the 0.5 fun plug, and I've also noticed that BusyBox v1.00 is running when I login via SSH, not BusyBox v1.10, which is bundled with the fun plug. I would like to use the newer BusyBox, as I don't particularly care to type the unlock code every time I connect using telnet/SSH.

One possibility that I explored was replacing the stock BusyBox with a symlink pointing to the BusyBox in /ffp/bin. This seems to work well until you attempt to restart the unit via the web GUI. The DNS never completely reboots, and it ends up in a strange state, locking out the telnet and SSH connections. There may have been other consequences to this approach, but I quickly restored the original BusyBox to avoid any other unpleasant surprises.

I suspect that there is something amiss in the PATH variable. I noticed in the /ffp/etc/rc script that the various fun plug folders (e.g. /ffp/bin, /ffp/sbin) are pre-pended to the PATH variable. Ostensibly, this should lead us to the newer BusyBox on login and in the shell. Yet when I echo my PATH env variable, it shows the following:

   /usr/bin:/bin:/usr/sbin:/sbin:/ffp/bin

Notice the fun plug bin folder is at the end . Is this the intended path structure, or is there something else at work here?

- skel

Offline

 

#3 2008-04-17 21:14:07

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Offline

 

#4 2008-04-17 21:27:42

skel
Member
Registered: 2008-04-17
Posts: 6

Re: How to run the shell after connect with Putty through OpenSSH

Thank you fonz, sorry if this is a FAQ. I searched all over the forum for the answer, but I guess I didn't delve deeply enough into that 9 page thread ;-)

-skel

Offline

 

#5 2008-04-18 04:12:53

skel
Member
Registered: 2008-04-17
Posts: 6

Re: How to run the shell after connect with Putty through OpenSSH

Switching the login shell to /ffp/bin/sh in the passwd file did indeed connect me to the newer BusyBox. I am now running with v1.10 upon connecting via telnet/SSH, which is great.

One anomaly that I have noticed, though, is that when I login through SSH with a user other than root, I receive several strange messages before arriving at the prompt...

   id: unknown user name: rs
   sh: 0: unknown operand

The prompt appears immediately following these two lines, and otherwise all seems normal. This text only appears when connecting with SSH (not telnet) for non-root users.

Not a show-stopper, but I wouldn't mind knowing the reason why this occurs and if it impairs any other operations within the shell.

-skel

Offline

 

#6 2008-04-18 05:49:48

KyleK
Member
From: Dresden, Germany
Registered: 2007-12-05
Posts: 1178

Re: How to run the shell after connect with Putty through OpenSSH

kenyloveg wrote:

My DNS 323 is running fun plug 0.5 now and 1.04 firmware.

The problem is when I use telnet, I can't access Transmission by Clutch if i did not use "export" to set "Transmission home". But it need me to run export everytime when i reboot DNS 323.
Fonz said I need to connect through SSH to have a profile which can save enviroment settings like export Transmission Home.
I can connect through SSH by using Putty now, but everytime i need to input 5784468 to get a shell prompt. And I noticed it' built in Busybox, not Fonz's new busybox in fun plug 0.5.
Is there anyway to get into Fon'z busybox directly after everytime reboot?
Once i set "export TRANSMISSION_HOME=mnt/HD_a2/downloads/.transmission", it will be saved to where? To funplug_script, to /etc/ssh/sshd_config or to etc/profile/?

Thanks for your help.

Put the export either in the fun_plug script, or in the start script for Transmission (in etc/start).

Offline

 

#7 2008-04-18 13:53:14

kenyloveg
Member
Registered: 2008-04-10
Posts: 41

Re: How to run the shell after connect with Putty through OpenSSH

Thank you Fonz, Kylek, and skel.

Offline

 

#8 2008-04-18 14:03:35

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: How to run the shell after connect with Putty through OpenSSH

skel wrote:

Switching the login shell to /ffp/bin/sh in the passwd file did indeed connect me to the newer BusyBox. I am now running with v1.10 upon connecting via telnet/SSH, which is great.

One anomaly that I have noticed, though, is that when I login through SSH with a user other than root, I receive several strange messages before arriving at the prompt...

   id: unknown user name: rs
   sh: 0: unknown operand

"id: unknown user name: rs" comes from /bin/id. It should use /ffp/bin/id. What does your PATH look like? Are you logging in as 'rs'?
Please test manually and post output of:

Code:

/bin/id -u
/bin/id -u rs
/ffp/bin/id -u
/ffp/bin/id -u rs

Do you have a ~/.profile file?

Offline

 

#9 2008-04-18 14:42:41

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: How to run the shell after connect with Putty through OpenSSH

skel wrote:

Thank you fonz, sorry if this is a FAQ. I searched all over the forum for the answer, but I guess I didn't delve deeply enough into that 9 page thread ;-)

In the search form, you can select that matching posts should be listed (and not matching topics). It's the list box on the right at the end of the form - very useful.

If you search e.g. for 5784468 and select 'posts', it's the third hit at the moment wink

Offline

 

#10 2008-04-18 17:12:15

skel
Member
Registered: 2008-04-17
Posts: 6

Re: How to run the shell after connect with Putty through OpenSSH

My path is as follows:

PATH=/ffp/bin:/usr/bin:/bin:.

Based on this, I would expect that the id command from /ffp/bin would execute rather than the one from /bin. Incidentally, when I execute id at the prompt following login, it does return the correct user and group information. Looking at the usage statement from id, it's coming from the new (1.10) BusyBox. Perhaps /bin/id is executed somewhere between login and the time that the correct path is exported?

I am not logging in with a user name of "rs"; my user name is first_initial + last_name, e.g. jsmith. I don't know where "rs" is coming from.

Here are the results from the executions of id that you suggested:

Code:

/bin/id -u
id: unknown user name: rs
/bin/id -u rs
id: unknown user name: rs
/ffp/bin/id -u
1000
/ffp/bin/id -u rs
id: unknown user name: rs

I haven't created a .profile for my user. I see that there is already a fun plug profile script which sets the path and the look & feel of the prompt, and that seems to be working OK.

EDIT

Wait a second. Now that I look at the /ffp/etc/profile script, I noticed in the first line:

Code:

if [ $(id -u) -eq 0 ]; then
    PATH=/ffp/sbin:/ffp/bin:/usr/sbin:/sbin:/usr/bin:/bin
else
    PATH=/ffp/bin:/usr/bin:/bin:.
fi
PS1='\u@\h:\w\$ '
PS2='> '
export PATH PS1 PS2

umask 022

So that is where the execution of /bin/id appears to take place. The thing I don't understand is why the original BusyBox's id command is having difficulty with this particular user? This only occurs for this one user when going through SSH; telnet logins don't encounter this issue, nor do other non-root users.

Last edited by skel (2008-04-18 17:25:23)

Offline

 

#11 2008-04-19 21:24:21

skel
Member
Registered: 2008-04-17
Posts: 6

Re: How to run the shell after connect with Putty through OpenSSH

I figured out the problem. Turns out the offending user belonged to several User Groups that were not appropriately defined. The user was a member of the "Administrators" and "PowerUsers" groups. These are not valid Group names, as names in *nix must me a maximum of 8 characters in length. I used the groupmod command to rename the groups to "admins" and "powrusrs", respectively. After that, the strange post-login messages disappeared. This is a little scary, as it seems like this odd behavior stemmed from a buffer overrun of some sort. Note that the bad groups names both end in the string "rs". Anyhow, all is well once again. Thanks for the assistance & prodding me in the right direction, fonz.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB