How do I automatically gain root access with Putty?

34,894

In putty: On the Connection > Data page, you can set an auto login username, and

On the Connection > SSH page, you can set a remote command such as sudo -i or sudo su -

If you don't ever want to have to type your password once, set up your ssh keys.

Share:
34,894
melanie
Author by

melanie

Updated on September 18, 2022

Comments

  • melanie
    melanie over 1 year

    Putty is set up to run like:

    putty.exe -load mysession -l myuser -pw mypass
    

    But it logs me in as myuser. For root access I need to type in the console:

    sudo -i
    

    Then it asks for my password again.

    Is there a way to automate this in Putty, so I don't have to type sudo -i and the password ? I'd like to have root access on startup by default.

    • melanie
      melanie almost 11 years
      Nope. I think it's because root doesn't have a password, so whatever I enter it appears to be incorrect
    • kmort
      kmort almost 11 years
      Good Idea: give root a password (use passwd root). Bad Idea:, make sure root has SSH permission using ssh_config. See cyberciti.biz/faq/allow-root-account-to-use-ssh-openssh , but realize this makes your system insecure.
    • melanie
      melanie almost 11 years
      This is just for a local dev server on my PC. I don't really care about security
    • melanie
      melanie almost 11 years
      hey thanks, I've set up a password for root, and now I can log in automatically with the command you suggested above :)
  • melanie
    melanie almost 11 years
    Thanks. I've managed to set public keys and stuff, added that remote command, but it still asks for my password to gain root access
  • Hurricane Hamilton
    Hurricane Hamilton almost 11 years
    Weird. I don't have keys set up in my instance of putty, so I did have to type in my password once, but once I typed it in (for login auth) it just dumped me to a root console, with the # prompt. I wonder where the difference comes from. same version of Ubuntu too. odd.