Remote Sudo

If your workflow involves administering remote systems or something similar, you probably have the following burned into your muscle memory. If, on the other hand, you’re like me and don’t have occasion to need root access on a remote machine very often, you can probably use a reminder. If you’re in the second category, here, courtesy of abo-abo, you go:

If you click on the tweet, you’ll see the next tweet, which explains that “cloud” is the name of a remote system defined in abo-abo’s ~/.ssh/config. Defining often used remote systems like this is something I do too and it saves me a bunch of time and mental cycles trying to remember domains or, worse yet, IP addresses.

This entry was posted in General and tagged . Bookmark the permalink.
  • Phil

    Double-posting because the Disqus spam-detector didn't like my initial comment. I'll delete this one once the first one shows up, but as a very brief summary in the interim:

    /ssh:cloud|sudo:root:/etc/passwd is wrong. It specifies a HOST value of "root". Don't do that.

    /ssh:cloud|sudo:cloud:/etc/passwd is correct.

    The former will appear to work fine, but it will then bite you when you try to do the same thing on a different host, because they will both use the proxy entry for "root@root". It's important to explicitly specify the correct hostname for each hop when you multi-hop, otherwise you might not end up on the server you thought you were connecting to!

  • Michael Albinus

    The example works by side effect, but the correct syntax would be /ssh:cloud|sudo:cloud:/etc/passwd

  • Phil

    jcs, I don't suppose you're able to deal with that "waiting to be approved" post of mine? It seems that other users should be able to click to read it, but it would be nice if it was visible by default.

    • jcs

      Are you seeing it now? I got no indication that the post was held up until I checked the original post. When I checked the moderation panel at Disqus it said there were no messages pending moderation but after fooling around a bit I did find your message.

      FWIW, the problem appears to be that it thought the /ssh:... lines were links and that the message was therefore spam. Sorry.

      • jcs

        I told Disqus you were a good guy so you shouldn't see the problem again.

      • Phil

        That did the trick, thank you.

        • jcs

          Good. Let me know directly if this problem reoccurs. Either Disqus isn't telling me or I'm somehow missing it when a message gets held in moderation.