Find the answer to your Linux question:
Results 1 to 7 of 7
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Putty SSH Command help

    I'm not really a Linux user, but I use a custom Linux firmware on my Asus RT-N56U router to allow me to remote send WOL (wake on LAN) packets and enable SSH tunneling. I recently upgraded to the Asus router and I'm having a problem getting Putty to send the WOL command.

    I previously used DD-WRT and Putty profile setup to login to the router and send the SSH command "/usr/sbin/wol -i -p 7 XX:XX:XX:8B:FB:A1." The router would send the WOL command and my computer would wake.

    With the new custom firmware, I can manually log in to the router and use the command "ether-wake -i br0 XX:XX:XX:8B:FB:A1" to send the WOL command. Everything works fine if I log in to the console and type this command. However, if I try to plug the command in to the SSH "Remote Command" box in Putty to automate the process (how I had it setup with my old router), Putty will login and then give the message "Connection closed by remote host." The router doesn't send the WOL command when this happens either.

    It almost seems like I need to delay the command being sent. That's just a random guess because I can't explain why I can type it and it work, but sending it through Putty doesn't work.

    Any help is appreciated.

    Thanks in advance.

  2. #2
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Hi and welcome

    My guess is, you are using two putty sesions for the interactive and wol usecase.
    Maybe there are differences between the two? IP, username, pw, private key, etc

    What you also can do to debug is to use multiple commands in "Remote Commands", like this:
    hostname; sleep 10
    This will print the hostname and then wait 10secs before clossing the session.
    You must always face the curtain with a bow.

  3. #3
    I've changed all the information that I know has changed (IP and username). I don't believe it's the information because I'm able to open the console and run the command manually. The command runs without any problems if I remove all text from the "Remote Commands" field in Putty.

    Unfortunately, running the multiple commands didn't appear to help either. I ran the remote commands "hostname; sleep 10; ether-wake -i br0 XX:XX:XX:8B:FB:A1" and it still gave me the "Connection closed by remote host" error. Running these commands launched the console, prompted me for my password, showed the hostname (RT-N56U), paused for 10 seconds, and then gave me the connection closed error.

    Thank you for the suggestions and I'm sorry if I'm not understanding something you've said correctly. I have a very poor understanding of Linux.

  4. $spacer_open
  5. #4
    I don't know if this helps at all, but the console launches something called BusyBox v1.20.2 when I log in to the console without running any remote commands. It seems like Putty is sending the ether-wake command before BusyBox is launched when I input the remote command. I think the sleep command made the router stop the launching process or it would have worked.

  6. #5
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    No worries.

    A few ideas:
    1) Call ether-wake with its full path.
    To do this, you need to find via an interactive sesion, where ether-wake is.
    In an interactive shell, call
    which ether-wake
    This should give you the absolute path.
    Once you have that, use it in the "remote command"

    2) Maybe the command shows some errors.
    Call it with the -D falg, which enables debug output

    3) put the sleep behind ether-wake, so that you have a chance to read the output.
    Last edited by Irithori; 02-01-2013 at 05:41 PM. Reason: typo
    You must always face the curtain with a bow.

  7. #6
    Awesome. I'm pretty sure your first idea worked. I used the command "which ether-wake" and it returned "usr/bin/ether-wake." I put this in the remote remote command along with my MAC address and ran it again. It appears to have worked. I'll have to do further testing to make sure (RDP in and put the computer to sleep again or wait until I get home to test it), but it definitely seems to have worked.

    Thanks for your help.

  8. #7
    I tested it some more over the weekend and everything works perfectly now. Thank you for your help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts