3

My question is twofold. I need to somehow re-enable telnet and/or ssh in a device where I currently only have root ftp access. Also, if I am going about this wrong, please let me know. Details to follow...

Background

I have a special development board running Arm Linux with the 2.6 kernel. (The device is the 9G45, but that is not really relevant to my question.) I was happily monkeying around with settings and such, I somehow caused sshd to stop working.

Upon restart, ssh connections were refused.

Troubleshooting

I have found that Lighttpd is working and serving up pages. This confirms that both network and some of the initialization works.

I have found that vsftpd is functioning and I do have root access here.

I can connect to telnet, but the documented default user named "guest" is not working. Neither is root.

Using ftp, I determined that the sshd pid file is not present, so I assume it is not running.

Unfortunately, connectiong via serial did not seem to work, but I have a support ticket out with the manufaturer, so maybe they will answer me.

Possible solutions (needs refining)

I figure that I may be able to get in through the root ftp access, monkey with an init script or something else, then possibly gain telnet access (or maybe set sshd to run later in the boot process).

I am not really sure where to go from here. If someone could build on my possible solution or propose a new one it would be greatly appreciated.

3

Fixing files

When you're limited to ftp access only on a system your only real option is to get/put files onto the device. But this turns out to often be all you need to "break" into a system. The approach you're going to want to take is to pull a file down to your local system, edit this file, and then put it back.

/etc/passwd & /etc/shadow

The files you'll want to start with are the /etc/passwd and /etc/shadow files. If you grab these you can then make sure that the user/name passwords are all set in there.

A big hint is that since you know root's password, you can copy the password string for this user from /etc/shadow to any other corresponding user so that you now know that user's password as well (it'll be the same one that root uses).

ssh access

Going beyond the accounts the same approach can be used to get sshd working as well. The config file for sshd is typically in this directory, /etc/ssh/sshd_config. You'll want to make sure that this file is in a usable state so that sshd,the daemon, can come up and allow you to login. NOTE: It's often the case that user root is not allowed to ssh into systems, so you might need to temporarily allow this, just to gain ssh access to the system. You can turn it off afterwards.

sshd service

You'll also need to make sure that sshd the service starts up when the system boots. This one is a little trickier. Given you're using Linux 2.6 I'm going to assume that your system is using /etc/init.d for the various services that are suppose to run on your system. You can create links to the files in /etc/init.d under /etc/rc3.d such that the sshd service starts up when the system reboots. Something like this:

$ ls -l /etc/rc3.d/ |grep ssh
lrwxrwxrwx 1 root root 14 Aug 10  2011 S55sshd -> ../init.d/sshd

starting the service

Getting this service to start is a little trickier, you'll either have to reboot (risky since you might lose ftp access) or if the system has cron or at services running you could add a task to either of these that would start the service at a specific point in time, say 1 minute from now.

Everything else

Once you have sshd access restored you can fix telnet and anything else from that shell, so I won't go any further and discuss these since they are beyond the score of restoring access with ssh working.

  • I really like your answer. Unfortunately, I did not solve the issue with the steps, but it looks correct. I am assuming some other underlying issue (even though sshd is at stock settings now). The manufacturer contacted me and explained how to connect directly to the board and reflash the stock images. Given time constraints at work, I think it is the best use of my time. But I so very much appreciate your help. – Terry Jan 17 '14 at 15:51
  • 1
    @Terry - sure thing. This was a bit of, "how do I hack into my system" type of Q, and I've had to do these types of steps before so I've personally used them, though if anyone ever asked me I would say, "No I've never locked myself out of my system(s) before"..8-) – slm Jan 17 '14 at 15:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.